SiMX Help‎ > ‎The Target Platform‎ > ‎Objects‎ > ‎TARGET Object‎ > ‎target.strlib‎ > ‎


Platform Objects


Search for a string and replace it with another string.  The look_for and replace_with input parameters can be arrays or comma separated multi values.  The look_for input parameter can be a regular expression(s), but if it is, then reg_expr should be set to "true".


target.strlib.Replace( input, look_for, replace_with, reg_expr )

look_for variant - This can be a string, array, or comma separated multi values or, if reg_expr is set to "true", look_for can be a regular expression
replace_with - This is the string that will replace the string(s) found
reg_expr Boolean (optional) - If reg_expr is set to "true", look_for can be a regular expression (default is false)

Return value

The input modified as specified


'---------- Start ----------
Function Start
Dim str, str2

str = "7-23-97"
str2 = target.strlib.Replace(str, "-", "/")
trg.Message( str2 )

End Function

In this example the goal is to replace the dashes in a string and replaces the with slashes, this could be used in situations where you need to change a string to match a database format, the ouput string will look like 7/23/97.

See also

TextConverter's "this" Object