@UpperCase (JavaScript)
Converts a string to uppercase.
Defined in
@Functions (JavaScript)Syntax
@UpperCase(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 lowercase characters to their equivalent uppercase.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(@UpperCase(cities), "FOO") == @True()) {
for(var i = 0, j = 0; i < cities.length; i++) {
if(@UpperCase(cities[i]) != "FOO") {
cities[j] = cities[i];
j++;
}
}
for(; i > j; i--) {
cities.pop();
}
}
p(cities);