Zum Hauptinhalt springen

StringHelper

A helper Class for String Operation

StringHelper

Constructors

Constructor

new StringHelper(): StringHelper

Returns

StringHelper

Methods

stringIsNullOrEmpty()

static stringIsNullOrEmpty(value): boolean

Checks if a string is null or empty.

Parameters

value

string

the string to check

Returns

boolean

true, if string is null or empty

Static

Member Of

StringHelper


stringReplaceNull()

static stringReplaceNull(value, replaceValue): String

Replace if a string is null with value

Parameters

value

String

the string to check

replaceValue

String

Returns

String

replaceValue, if value to check is null, else the string value

Static

Member Of

StringHelper


padLeft()

static padLeft(text, totalLength, paddingChar): string

Returns a new string that right-aligns the characters by padding them on the left with a specified character, for a specified total length.

Parameters

text

the text that should be converted

string | number

totalLength

number

amount of total characters

paddingChar

string

the character for example "0" for "007"

Returns

string

  • Returns a new string that right-aligns the characters by padding them on the left with a specified character.

Static

Member Of

StringHelper


padRight()

static padRight(text, totalLength, paddingChar): string

Returns a new string that left-aligns the characters by padding them on the left with a specified character, for a specified total length.

Parameters

text

the text that should be converted

string | number

totalLength

number

amount of total characters

paddingChar

string

the character for example "0" for "007"

Returns

string

  • Returns a new string that left-aligns the characters by padding them on the left with a specified character.

Static

Member Of

StringHelper


cleanCRLF()

static cleanCRLF(text): string

Replaces escaped CRLF (\r\n) in the specified string into correct CRLF-Format (\r\n).

Parameters

text

string

the escaped text that has escaped CRLF

Returns

string

  • returns an string with correct CRLF

Static

Member Of

StringHelper


formatString()

static formatString(text): string

Removes special characters that are not allowed in file names.

Parameters

text

string

string that is not safe for a file name

Returns

string

A valid string for a file name

Static

Member Of

StringHelper


isNumber()

static isNumber(text): boolean

Checks if the provided string is a number

Parameters

text

string

the string to check

Returns

boolean

  • true if string is a number

Static

Member Of

StringHelper


convertToNumber()

static convertToNumber(text): number

Converts a string into a number

Parameters

text

string

the text to convert

Returns

number

  • returns a number

Static

Member Of

StringHelper