@LowerCase (JavaScript)
Converts a string to lowercase.
Defined in
@Functions (JavaScript)Syntax
@LowerCase(value:string) : string
Parameter | Description |
---|---|
value |
A string or array of strings. |
Return value | Description |
---|---|
string |
The converted string or array of strings. |
Usage
This function affects alphabetic characters in the string changing uppercase characters to their equivalent lowercase.If the parameter is an array, the result is an array with all elements converted.
Examples
A useful employment of this function is to make comparisons regardless of case, as demonstrated in this example.function p(stuff) {
print("<<<" + stuff + ">>>");
}
var cities = new Array("Paris", "foo", "Berlin", "Foo", "Moscow");
//var cities = new Array("Paris", "Berlin", "London", "Moscow");
if(@Contains(@LowerCase(cities), "foo") == @True()) {
for(var i = 0, j = 0; i < cities.length; i++) {
if(@LowerCase(cities[i]) != "foo") {
cities[j] = cities[i];
j++;
}
}
for(; i > j; i--) {
cities.pop();
}
}
p(cities);