Skip to content

Latest commit

 

History

History
211 lines (120 loc) · 3.45 KB

File metadata and controls

211 lines (120 loc) · 3.45 KB

@hubxu/utils / Exports / string

Module: string

Table of contents

References

Functions

References

convertCase

Re-exports convertCase


toCamelCase

Re-exports toCamelCase


toKebabCase

Re-exports toKebabCase


toPascalCase

Re-exports toPascalCase


toSentenceCase

Re-exports toSentenceCase


toSnakeCase

Re-exports toSnakeCase


toTitleCase

Re-exports toTitleCase

Functions

byteSize

byteSize(str): number

计算字符串对应的字节大小

Parameters

Name Type
str string

Returns

number

Defined in

src/string/index.ts:44


compactWhitespace

compactWhitespace(str): string

缩减字符串中的空格(多个)为一个空格,使其更加紧凑

Parameters

Name Type
str string

Returns

string

Defined in

src/string/index.ts:21


containsWhitespace

containsWhitespace(str): boolean

检查字符串中是否有空格。 至少存在一个空格。

Parameters

Name Type
str string

Returns

boolean

Defined in

src/string/index.ts:7


removeNonASCII

removeNonASCII(str): string

删除非 ASCII 字符

Example

removeNonASCII('äÄçÇéÉêlorem-ipsumöÖÐþúÚ'); // 'lorem-ipsum'

Parameters

Name Type
str string

Returns

string

Defined in

src/string/index.ts:29


removeWhitespace

removeWhitespace(str): string

删除字符串中的空格(多个)

Parameters

Name Type
str string

Returns

string

Defined in

src/string/index.ts:14


stripHTMLTags

stripHTMLTags(str): string

使用正则表达式从字符串中删除 HTML/XML 标签

Example

tripHTMLTags('<p><em>lorem</em> <strong>ipsum</strong></p>'); // 'lorem ipsum'

Parameters

Name Type
str string

Returns

string

Defined in

src/string/index.ts:37