Module utils/string-utils
Functions
between
between( text: string , key1: string , key2: string , trim?: boolean ) : string
Parameters
text: string
key1: string
key2: string
trim: boolean = false
Returns string
capitalize
capitalize( text: string ) : string
Parameters
Returns string
collapseWhitespace
collapseWhitespace( text: string ) : string
Parameters
Returns string
contains
contains( text: string , substring: string ) : boolean
Parameters
text: string
substring: string
Returns boolean
count
count( text: string , key: string ) : number
Parameters
Returns number
cutUsing
cutUsing( text: string , maxLength: number , suffix?: string , lengthIncludeSuffix?: boolean ) : string
Parameters
text: string
maxLength: number
suffix: string = "..."
lengthIncludeSuffix: boolean = true
Returns string
format
format( text: string , values: string [] , placeHolder?: string ) : string
Parameters
text: string
values: string []
placeHolder: string = "{}"
Returns string
getAsciiArray
getAsciiArray( thisArg: string ) : number []
Parameters
Returns number []
getFormattedNumber
getFormattedNumber( num: string , prefix?: string ) : string
Parameters
num: string
prefix: string = "+421"
Returns string
getLastPart
getLastPart( text: string , divider?: string ) : string
Parameters
text: string
divider: string = " "
Returns string
joinSingle
joinSingle( prefix: string , divider: string , postfix: string ) : string
Parameters
prefix: string
divider: string
postfix: string
Returns string
joinString
joinString( data: string [] , delimiter?: string , prefix?: string , postfix?: string ) : string
Parameters
data: string []
delimiter: string = " "
prefix: string = ""
postfix: string = ""
Returns string
occurrences
occurrences( text: string , key: string , overlapping?: boolean ) : number
Parameters
text: string
key: string
overlapping: boolean = false
Returns number
removeAccentedCharacters
removeAccentedCharacters( word: string ) : string
Parameters
Returns string
removeAll
removeAll( text: string , words: string [] ) : string
Parameters
text: string
words: string []
Returns string
removeEmptyLines
removeEmptyLines( content: string ) : string
Parameters
Returns string
repeat
repeat( text: string , numberOfRepetitions: number ) : string
Parameters
text: string
numberOfRepetitions: number
Returns string
replaceForAll
replaceForAll( content: string , values: string [] , placeHolder: string ) : string []
Parameters
content: string
values: string []
placeHolder: string
Returns string []
swapCase
swapCase( text: string ) : string
Parameters
Returns string
template
template( text: string , values: StringMap < unknown > , start?: string , end?: string ) : string
Parameters
text: string
start: string = "{{"
end: string = "}}"
Returns string
toBasicForm
toBasicForm( text: string ) : string
Parameters
Returns string
toCapital
toCapital( text: string ) : string
Parameters
Returns string
toLowerCamelCase
toLowerCamelCase( text: string ) : string
Parameters
Returns string
toLowerSnakeCase
toLowerSnakeCase( text: string ) : string
Parameters
Returns string
toUpperCamelCase
toUpperCamelCase( text: string ) : string
Parameters
Returns string
toUpperSnakeCase
toUpperSnakeCase( text: string ) : string
Parameters
Returns string
transformToBasicFormat
transformToBasicFormat( text: string ) : string
Parameters
Returns string
Legend
Variable
Function
Function with type parameter
Type alias
Type alias with type parameter
Interface
Interface with type parameter
Class
Class with type parameter
between("my name is gabriel and I am 26 years old", "NAME", "gabriel") => "my name is " between("my name is gabriel and I am 26 years old", "name", "GABRIEL") => " is gabriel and I am 26 years old" between("my name is gabriel and I am 26 years old", "name", "gabriel") => " is " between("my name is gabriel and I am 26 years old", "name", "gabriel", true) => "is"