Strings are made up of many different pieces of information in many cases. Concatenation is the act of combining string pieces to create a larger whole. In fact, it’s hard to create any application without using concatenation. Essentially, concatenation involves adding strings together by using the plus sign (+).
Consider two strings: ThisString and ThatString. ThisString contains “Hello ”, and ThatString contains “World”. When you see
var FinalString = ThisString + ThatString;
in an application, FinalString equals “Hello World”. Using the plus sign concatenates the two strings into a new string.
toLocaleLowerCase(): Changes all the characters in a string to lowercase versions while respecting lowercase rules for the current locale.
toLocaleUpperCase(): Changes all the characters in a string to uppercase versions while respecting the uppercase rules for the current locale.
toLowerCase(): Changes all the characters in a string to lowercase equivalents without regard to locale.
toUpperCase(): Changes all the characters in a string to uppercase equivalents without regard to locale.
As with formatting numbers, the best way to see string formatting is to create an application to do it. As with the DisplayNumber.HTML page, this page begins with a global variable, ThisString, that contains “This is a Sample String”. The following code shows how to use the various functions.
Unlike the number-formatting functions, you won’t find any way to customize the string output. What you see depends on your browser and your locale.