Monday, 1 June 2009

Javascript: more string stuff

from here: http://articles.techrepublic.com.com/5100-10878_11-5147185.html
  • concat() - Combines the text of two or more strings and returns a new string.
  • indexOf() – Returns the starting index of a substring within another string. A –1 is returned if no match is found.
  • charAt() – Returns the character at the specified location.
  • lastIndexOf() - Returns the index within the string of the last occurrence of the specified value, or -1 if not found.
  • match() - Used to match a regular expression against a string.
  • substring() – A portion of a string is returned. A starting and ending location are passed to this function.
  • replace() – Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.
  • search() - Executes the search for a match of a regular expression. If successful, search returns the index of the match inside the string. Otherwise, it returns -1.
  • slice() - Extracts a section of a string and returns a new string.
  • split() - Splits a string into an array of strings by separating the string into substrings.
  • length() – The length of the string is returned as the count of the number of characters it contains.
  • toLowerCase() – Converts the entire string to lower case.
  • toUpperCase() – Converts the entire string to upper case.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home