Skip to main content

datapipe-js/string

datapipe-js/string contains a set of helper functions to work with JavaScript strings

replaceAll#

Replace all string function

replaceAll(text: string, searchValue: string, replaceValue = ''): string

formatCamelStr#

Formats string to the Camel Case

formatCamelStr(str = ''): string

trimStart#

Trims characters from the start

  • characters characters to trim
trimStart(text: string, characters = " \n\t\r"): string

trimEnd#

Trims characters at the end

  • characters characters to trim
trimEnd(text: string, characters = " \n\t\r"): string

trim#

Trims characters in both sides

  • characters characters to trim
trim(text: string, characters = " \n\t\r"): string

split#

Splits text into tokens. Also, it supports multiple separators and will respect open/close brackets.

split('field1=func(a,b,c),field2=4', ',', ['()'])
// will result into `["field1=func(a,b,c)", "field2=4"]