ReplaceList
Replaces occurrences of the elements from a delimited list, in a string with corresponding elements from another delimited list.
Method Signature
ReplaceList(string=[string], list1=[string], list2=[string], delimiter_list1=[string], delimiter_list2=[string], includeEmptyFields=[boolean])
Arguments
Argument
Type
Required
Description
Default
string
string
true
The string to operate on
list1
string
true
The first delimited list of search values
list2
string
true
The second delimited list of replacement values
delimiter_list1
string
false
The delimiters for list 1
,
delimiter_list2
string
false
The delimiters for list 2
,
includeEmptyFields
boolean
false
Whether to include empty fields in the final result
false
Examples
Tag Example
<bx:set myString = "My test string" >
<bx:set mySubstring1 = "Test, String" >
<bx:set mySubString2 = "Replaced, Sentence" >
<bx:output>#replaceListNoCase( myString, mySubstring1, mySubString2 )#</bx:output>
Result: My Replaced Sentence
Additional Examples
writeDump( replaceListNoCase( "Hi USER!, Have a nice day.", "hi,user", "Welcome,buddy" ) ); // Welcome buddy!, Have a nice day.
// Member function
str = "xxxAbCdefghijxxXabcDefghij";
writeDump( str.replaceListNoCase( "a,b,c,d,e,f,g,h,i,j", "0,1,2,3,4,5,6,7,8,9" ) );
Related
Last updated
Was this helpful?