Character and String Functions

As well as providing JavaScript programmers with the Math object to provide a rich library of functions that can be carried out on numeric data types, there is also a strong provision of inbuilt functions that can be used to manipulate and work with characters and strings.

For example, JavaScript has an inbuilt character function in a computer language that allows for changes between lower and upper case and vice-versa. This can either be for a single character or a string of characters. Examples of such functions in JavaScript are:

toLowerCase( ) ;

toUpperCase( ) ;

Each of these functions work as follows:

var words ='This is a Test!';

alert (words.toLowerCase() + " " + words.toUpperCase()) ;

Lower to Upper case output

JavaScript’s character and string function is incorporated into the String Object. The String object can be used to carry out many different character and string manipulations.

String functions work through the inbuilt String object. In order to use the properties and methods of String the string must be created.

Next: Date and Time Functions