Thursday, April 4, 2013

Javascript Functions On the String Object



The String object let's you work with text.

Syntax for creating a String object :  var myStr=new String(string);

String Object Properties
Constructor A reference to the function that created the object
Length Returns the number of characters in a string
Prototype Allows you to add properties and methods to the object

String Object Methods
anchor() :   Creates an HTML anchor
big() :   Displays a string in a big font
blink() :   Displays a blinking string
bold() :   Displays a string in bold
charAt() :   Returns the character at a specified position
charCodeAt() :   Returns the Unicode of the character at a specified position
concat() :   Joins two or more strings
fixed() :   Displays a string as teletype text
fontcolor() :   Displays a string in a specified color
fontsize() :   Displays a string in a specified size
fromCharCode() :   Takes the specified Unicode values and returns a string
indexOf() :   Returns the position of the first occurrence of a specified string value in a string
italics() :   Displays a string in italic
lastIndexOf() :   Returns the position of the last occurrence of a string value, searching backwards
link() :   Displays a string as a hyperlink
match() :   Searches for a specified value in a string
replace() :   Replaces some characters with some other characters in a string
search() :   Searches a string for a specified value
slice() :   Extracts a part of a string and returns the extracted part in a new string
small() :   Displays a string in a small font
split() :   Splits a string into an array of strings
strike() :   Displays a string with a strikethrough
sub() :   Displays a string as subscript
substr() :   Extracts a specified number of characters in a string, from a start index
substring() :   Extracts the characters in a string between two specified indices
sup() :   Displays a string as superscript
toLowerCase() :   Displays a string in lowercase letters
toUpperCase() :   Displays a string in uppercase letters
toSource() :   Represents the source code of an object
valueOf() :   Returns the primitive value of a String object




No comments:

Post a Comment