String object's properties and methods
2005-04-07 10:34
507 查看
String object
The String object is used to work with text.The String object's properties and methods are described below:
NN: Netscape, IE: Internet Explorer
Properties
Syntax: object.property_nameProperty | Description | NN | IE |
---|---|---|---|
constructor | 4 | 4 | |
length | Returns the number of characters in a string | 2 | 3 |
Methods
Syntax: object.method_name()Method | Description | NN | IE |
---|---|---|---|
anchor("anchorname") | Returns a string as an anchor | 2 | 3 |
big() | Returns a string in big text | 2 | 3 |
blink() | Returns a string blinking | 2 | |
bold() | Returns a string in bold | 2 | 3 |
charAt(index) | Returns the character at a specified position | 2 | 3 |
charCodeAt(i) | Returns the Unicode of the character at a specified position | 4 | 4 |
concat() | Returns two concatenated strings | 4 | 4 |
fixed() | Returns a string as teletype | 2 | 3 |
fontcolor() | Returns a string in a specified color | 2 | 3 |
fontsize() | Returns a string in a specified size | 2 | 3 |
fromCharCode() | Returns the character value of a Unicode | 4 | 4 |
indexOf() | Returns the position of the first occurrence of a specified string inside another string. Returns -1 if it never occurs | 2 | 3 |
italics() | Returns a string in italic | 2 | 3 |
lastIndexOf() | Returns the position of the first occurrence of a specified string inside another string. Returns -1 if it never occurs. Note: This method starts from the right and moves left! | 2 | 3 |
link() | Returns a string as a hyperlink | 2 | 3 |
match() | Similar to indexOf and lastIndexOf, but this method returns the specified string, or "null", instead of a numeric value | 4 | 4 |
replace() | Replaces some specified characters with some new specified characters | 4 | 4 |
search() | Returns an integer if the string contains some specified characters, if not it returns -1 | 4 | 4 |
slice() | Returns a string containing a specified character index | 4 | 4 |
small() | Returns a string as small text | 2 | 3 |
split() | Splits a string into an array of strings | 4 | 4 |
strike() | Returns a string strikethrough | 2 | 3 |
sub() | Returns a string as subscript | 2 | 3 |
substr() | Returns the specified characters. 14,7 returns 7 characters, from the 14th character (starts at 0) | 4 | 4 |
substring() | Returns the specified characters. 7,14 returns all characters from the 7th up to but not including the 14th (starts at 0) | 2 | 3 |
sup() | Returns a string as superscript | 2 | 3 |
toLowerCase() | Converts a string to lower case | 2 | 3 |
toUpperCase() | Converts a string to upper case | 2 | 3 |
document.write(str.substr(2,6)) // school
document.write(str.substring(2,6)) // scho
相关文章推荐
- Javascript Object Method Properties console.log View all methods and properties of the object
- The Boolean object's properties and methods
- Date object's properties and methods
- Math object's properties and methods
- [Javascript] Prototype, hasOwnProperty(), valueOf() and toString() methods.
- ioObjectAndProperties
- Professional JS(5.5.5-function properties and methods&&5.6primitive wrapper type)
- Difference between event.target and event.currentTarget properties in an event object.
- New C# "Orcas" Language Features: Automatic Properties, Object Initializers, and Collection Initializers
- Object(String,list,object and so on) To Json
- JavaScript Patterns 5.3 Private Properties and Methods
- HTML DOM Properties and Methods
- How to avoid traps and correctly override methods from java.lang.Object
- Object-C学习笔记七-----Foundation Kit快速教程NSString and NSMutableString
- .Net 3.5新特性(1)Automatic Properties, Object Initializers, and Collection Initializers
- Microsoft.XMLDOM(XMLDOM)对象的属性和方法(Methods and properties of Microsoft.XMLDOM)
- Layout Properties And Methods In Element, HTMLElement And Window
- Microsoft.XMLDOM(XMLDOM)对象的属性和方法(Methods and properties of Microsoft.XMLDOM)
- 2.4 The Object Model -- Computed Properties and Aggregate Data with @each(计算的属性和使用@each聚合数据)
- new Object and new String