360 Secure SkillHub
360 安全技能中心

string-utils

该 Skill 是一个 JavaScript 字符串工具模块,提供大小写转换、修剪与填充、截断、slug 生成、HTML 转义/反转义、URL 编解码、模板插值和字符串相似度等函数;文档给出调用示例,未说明网络或外部服务依赖。

分类:效率
jpengcheng523-netizen
jpengcheng523-netizen
热度 26.39
最近更新 2026-05-11 17:37:03

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add jpengcheng523-netizen/jpeng-string-utils
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
string-utils
description
Provides string manipulation and transformation operations for working with text. Use when you need to transform, format, or manipulate strings.

String Utils

Provides string manipulation and transformation operations.

Usage

const str = require('./skills/string-utils');

// Case conversion
const camel = str.toCamelCase('hello world'); // helloWorld
const snake = str.toSnakeCase('helloWorld'); // hello_world
const kebab = str.toKebabCase('helloWorld'); // hello-world

// Trimming and padding
const trimmed = str.trim('  hello  '); // 'hello'
const padded = str.padLeft('5', 3, '0'); // '005'

// Truncation
const short = str.truncate('hello world', 8); // 'hello...'

// Slug generation
const slug = str.slugify('Hello World!'); // 'hello-world'

// Escape/unescape
const escaped = str.escapeHtml('<div>'); // '&lt;div&gt;'

Features

  • Case conversion (camelCase, snake_case, kebab-case, PascalCase, etc.)
  • Trimming and padding
  • Truncation with ellipsis
  • Slug generation
  • HTML escape/unescape
  • URL encoding/decoding
  • Template interpolation
  • String similarity