Deletes/replaces the characters within a text and eliminates (truncates) blanks at the beginning and end of the text.

Syntax

XIH.CleanString(text, charactersToBeReplaced)
XIH.CleanString(text, charactersToBeReplaced, trim)
XIH.CleanString(text, charactersToBeReplaced, replaceWith)
XIH.CleanString(text, charactersToBeReplaced, replaceWith, trim)

Parameters

Parameter

Data type

Description

Sample

text

string

String that has unwanted characters in it.

"I!am?a?string"

charactersToBeReplaced

string

String specifies which characters should be replaced or filtered out.

"!"

replaceWith

char

String specifies with what the characters should be replaced

' '

trim

bool

Bool specifying if the white spaces at the end and at the beginning of the string should be cut  

true/false

Remarks

The following command is useful to delete special characters "!,;. _-#~+*?=}{[]!§$%&/|><".

Be careful with the spelling of the characters to be replaced.

Available starting from version 5.5.

Returns a string.

Examples

XIH.CleanString("prI! ar!m cp!l!erp!a!n","rp!")
XIH.CleanString(" I!am!a?string????? ","!?",' ',true)