ReplaceNoCase
Replaces occurrences of substring1 in a string with obj, in a specified scope.
The search is case-sensitive. Function returns original string with replacements made
Method Signature
ReplaceNoCase(string=[string], substring1=[string], obj=[any], scope=[string], start=[string])
Arguments
Argument
Type
Required
Description
Default
string
string
true
The string to search
substring1
string
true
The substring to search for
obj
any
true
The string to replace substring1 with
scope
string
true
The scope to search in
one
start
string
false
1
Examples
Script Syntax
getVal = replaceNoCase( "Boxlang", "u", "a" );
writeDump( getVal );
Result: Expected Result: Boxlang
Tag Syntax
<bx:set getVal = replaceNoCase( "Boxlang", "O", "a", "ALL" ) >
<bx:dump var="#getVal#">
Result: Expected Result: Boxlang
Additional Examples
writeDump( replaceNoCase( "xxabcxxabcxx", "ABC", "def" ) );
writeDump( replaceNoCase( "xxabcxxabcxx", "abc", "def", "All" ) );
writeDump( replaceNoCase( "xxabcxxabcxx", "AbC", "def", "hans" ) );
writeDump( replaceNoCase( "a.b.c.d", ".", "-", "all" ) );
test = "camelcase CaMeLcAsE CAMELCASE";
test2 = replaceNoCase( test, "camelcase", "CamelCase", "all" );
writeDump( test2 );
writeDump( var=replaceNoCase( "One string, two strings, Three strings", {
"one" : 1,
"Two" : 2,
"three" : 3,
"string" : "txt",
"text" : "string"
} ), label="replaceNoCase via a struct" );
// struct keys need to be quoted
Related
Last updated
Was this helpful?