Please rate how useful you found this document: 
No votes yet

String Functions

capitalize()

capitalize() converts the first letter in each word into an uppercase letter. Subsequent letters in each word are changed into lowercase letters.

string capitalize(string textToConvert)

Parameters:

  • string textToConvert: The string to capitalize.

Return value:

  • string: Returns the introduced text with the first letter capitalized in each word and the subsequent letters in lowercase letters.

Example:

@@phrase1 = capitalize("hello world");
@@phrase2 = capitalize("hElLo wOrLd");

Both @@phrase1 and @@phrase2 will be set to "Hello World".

lowerCase()

lowerCase() returns a string with all the letters converted into lower case letters.

string lowerCase(string textToConvert)

Parameters:

  • string textToConvert: A string to convert to lower case letters.

Return value:

  • The function returns a string with the text converted into lower case letters.

Example:

@@phrase1 = lowerCase('HELLO WORLD');
@@phrase2 = lowerCase('HeLlO WoRlD');

Both @@phrase1 and @@phrase2 will be set to "hello world".

upperCase()

upperCase() returns a string converted into all UPPERCASE letters.

string upperCase(string textToConvert)

Parameters:

  • string textToConvert: A string to convert to UPPERCASE letters.

Return value:
A string converted into UPPERCASE letters.

Example:

@@phrase1 = upperCase('hello world');
@@phrase2 = upperCase('helLO WORld');

Both @@phrase1 and @@phrase2 will be set to "HELLO WORLD".