Methods and Properties of the String Object : JavaScript DHTML examples (example source code) » Language Basics » String

JavaScript DHTML
C++
Java Products
Java Articles
JavaScript DHTML Home  »   Language Basics   » [  String  ]   
 



Methods and Properties of the String Object


/*
JavaScript Unleashed, Third Edition
by Richard Wagner and R. Allen Wyke 

ISBN: 067231763X
Publisher Sams CopyRight 2000



+------------+----------------+------------------------------------------+
   Type         Item            Description
+------------+----------------+------------------------------------------+
  Method
+------------+----------------+------------------------------------------+
               anchor()          Creates an instance of the 'a' tag with the name 
                                 attribute set to the string passed to the method.
+------------+----------------+------------------------------------------+
               big()             Converts the string into an instance of the <big> tag.
+------------+----------------+------------------------------------------+
               blink()           Converts the string into an instance of the <blink> tag.
+------------+----------------+------------------------------------------+
               bold()            Converts the string into an instance of the <bold> tag.
+------------+----------------+------------------------------------------+
               charAt()          Returns the character at the index passed to 
                                 the method.
+------------+----------------+------------------------------------------+
               charCodeAt()      Returns the ISO-Latin-1 number of the character 
                                 at the index passed to the method.
+------------+----------------+------------------------------------------+
               concat()           Concatenates the two strings passed to return 
                                 a new string. This method was added in JavaScript 1.2.
+------------+----------------+------------------------------------------+
               fixed()           Converts the string into an instance of the <tt> 
                                 fixed pitch font tag.
+------------+----------------+------------------------------------------+
               fontcolor()       Sets the color attribute of an instance of the <font> tag.
+------------+----------------+------------------------------------------+
               fontsize()        Sets the size attribute of an instance of the <font> tag.
+------------+----------------+------------------------------------------+
               fromCharCode()    Returns the string value of the ISO-Latin-1 
                                 number passed to the method.
+------------+----------------+------------------------------------------+
               indexOf()         Returns the index of the first occurrence of the 
                                 string passed to the method within an instance 
                                 of a String object.
+------------+----------------+------------------------------------------+
               italics()         Converts the string into an instance of the <i> tag.
+------------+----------------+------------------------------------------+
               lastIndexOf()     Returns the index of the last occurrence of the 
                                 string passed to the method within an instance 
                                 of a String object.
+------------+----------------+------------------------------------------+
               link()            Converts the string into an instance of the <a> 
                                 tag and sets the href attribute with the URL 
                                 that is passed to the method.
+------------+----------------+------------------------------------------+
               match()           Returns an array containing the matches found 
                                 based on the regular expression passed to the 
                                 method. This method was added in JavaScript 1.2.
+------------+----------------+------------------------------------------+
               replace()         Performs a search and replace, using the regular 
                                 expression and replace string passed to the method, 
                                 on the instance of a String that calls it. This 
                                 method was added in JavaScript 1.2.
+------------+----------------+------------------------------------------+
               search()          Returns the index location of the match found in 
                                 the string passed to the method. A [ms]1 is 
                                 returned if the string is not found. This method 
                                 was added in JavaScript 1.2.
+------------+----------------+------------------------------------------+
               slice()           Returns the string between the beginning and ending 
                                 indexes passed to the method. If a negative number 
                                 is passed, the index is referenced from the end of 
                                 the string passed. This method was added in 
                                 JavaScript 1.2.
+------------+----------------+------------------------------------------+
              small()            Converts the string into an instance of the 
                                 <small> tag.
+------------+----------------+------------------------------------------+
              split()            Returns the string split into segments defined by 
                                 the string and instance limit passed to the method. 
                                 This method was added in JavaScript 1.1.
+------------+----------------+------------------------------------------+
              strike()           Converts the string into an instance of the <strike> tag.
+------------+----------------+------------------------------------------+
              sub()              Converts the string into an instance of the <sub> tag.
+------------+----------------+------------------------------------------+
              substr()           Returns the string beginning with the indexed 
                                 location and number of characters to return. 
                                 If a negative number is passed, the index is 
                                 referenced from the end of the string passed. 
                                 This method was added in JavaScript 1.2.
+------------+----------------+------------------------------------------+
              substring()        Returns the string between the beginning and 
                                 ending indexes passed to the method.
+------------+----------------+------------------------------------------+
              sup()              Converts the string into an instance of the <sup> tag.
+------------+----------------+------------------------------------------+
              toLowerCase()     Converts all the characters in the string to lowercase.
+------------+----------------+------------------------------------------+
              toSource()        Returns the string representation of the String passed. This method was added in JavaScript 1.3.
+------------+----------------+------------------------------------------+    
              toString()        Returnsthe characters passed as type String. 
                                This method was added in JavaScript 1.3.
+------------+----------------+------------------------------------------+
              toUpperCase()     Converts all the characters in the string to uppercase.
+------------+----------------+------------------------------------------+
 Property
+------------+----------------+------------------------------------------+
              length            Returns the length of the string.
+------------+----------------+------------------------------------------+
              prototype         Provides the capability for a programmer to add 
                                properties to instances of the String object. 
                                This property was added in JavaScript 1.1.
+------------+----------------+------------------------------------------+
*/
Related examples in the same category
1.  Demo all String methods
2.  String utility: word count, replace and capitalize
3.  Strip Commas
4.  Text Range Search and Replace (IE only)
5.  Counting the Words in a Text String
6.  Reversing a String
7.  Trimming a String Using Regular Expressions
8.  String encode and decode
9.  Capitalizing the First Letter in Each Word of a String
10.   Playing with Strings
11.   Using the String Object's Link Method
12.  Using a for Loop to Reverse a String
13.   Concatenate JavaScript String
14.  String length: number of characters in a string.
15.  String fontcolor(): a string in a specified color
16.  String indexOf(): string position
17.  String Validation
18.  Using Quotes within Strings
19.  Using the String Object
20.  String toUpperCase
21.  Lab for string.replace() and string.search()
22.  Slicing a String
23.  A String Object Prototype
24.  Creating a Custom toString() Method
25.  Reading a Portion of a String
26.  Source Code for a Sample Page That Formats a String Object with the 'a' Tag
27.  Source Code for Our String-Formatting Script
28.  Adding a replace() Method to the String Object
29.   Creating a Function That Will Search and Replace in Strings
30.   Using the indexOf() Method to Find All Occurrences of the Letter e in a Sentence
31.  Using the indexOf() Method to Find All Occurrences of the Letter e in a Sentence
32.  String match(): returns the text if found
33.  String substr() and substring(): returns a specified part of a string
34.  String toLowerCase() and toUpperCase(): converts a string to lowercase and uppercase
35.  Converting Strings to Upper Case
36.  String encoder








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.