360 Secure SkillHub
360 安全技能中心

string-utils

核心功能涵盖大小写转换(驼峰、蛇形等)、修剪填充、截断、slug生成、HTML转义、URL编解码等多种文本操作。适用于调整文本格式、生成友好链接、转义特殊内容等场景,以字符串及参数为输入,返回处理后的目标字符串,支持代码调用。

jpengcheng523-netizen
jpengcheng523-netizen
热度 42.13
最近更新 2026-05-11 17:37:03
分类:开发依赖:代码执行应用场景:数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add 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