Function: StrUpper
Function: StrUpper

Function: StrUpper

StrUpper ( STRING )

Returns a new string with all of the case-having characters converted to upper-case.

Parameters

Parameter Type Description
STRING VALUE(STRING) The input string.

Returns

VALUE(STRING) A new string with all of the case-having characters converted to lower-case.

What It Does

This returns the resulting string where all of the applicable characters in it are converted to upper-case. Characters without a typographical case are not changed.


	a = strUpper("Maximillian");       // a = "MAXIMILLIAN"
	a = strUpper("this is shouting!"); // a = "THIS IS SHOUTING!"
	a = strUpper("HELLO");             // a = "HELLO"

Example

String Manipulation Examples


world
{
	start()
	{
		// Concatenation
		textln("to" + "gether");                                // "together" 
		textln(strConcat("to", "gether"));                      // "together" 
		textln(strConcat(strConcat("to", "gether"), "ness"));	// "togetherness"
		textln(4 + 5);											// 9
		textln(strConcat(4, 5));								// "45" (both values are converted to strings first)
		textln("");

		// Substring
		textln(substring("applejack", 0, 5));		// "apple" 
		textln(substring("applejack", 5, 9));		// "jack" 
		textln(substring("applejack", 9, 5));		// "" 
		textln(substring("applejack", -3, 100));	// "applejack" = substring("applejack", 0, 9)
		textln(substring(123, 0, 1));				// "1" (first value is converted to a string first)
		textln("");

		// Lower-case convert.
		textln(strLower("Apples and Oranges"));		// "apples and oranges"
		textln(strLower("HELLO!!!"));				// "hello!!!"
		textln(strLower("123456789"));				// "123456789"
		textln("");
		
		// Upper-case convert.
		textln(strUpper("Apples and Oranges"));		// "APPLES AND ORANGES"
		textln(strUpper("hey."));					// "HEY."
		textln(strUpper("123456789"));				// "123456789"
		textln("");

		// Get single character.
		textln(strChar("Apples and Oranges", 0));	// "A"
		textln(strChar("This is a string.", 5));	// "i"
		textln(strChar(12345, 2));					// "3" (converted to string first)
		textln(strChar("apple", -1));				// "" (out of range)
		textln("");

		// string trim.
		textln(strTrim("      apple"));				// "apple"
		textln(strTrim("apple      "));				// "apple"
		textln(strTrim("   apple   "));				// "apple"
		textln(strTrim("\tapple\t"));				// "apple"
						 
		quit;
	}
}

Additional Technical Notes

The concept of "upper-case" and "lower-case" are defined by character sets, encodings, and locales (and to an aesthetic degree, fonts). Be mindful of this using this function.

×

Modal Header