String Object's Properties and Methods

xiaoxiao2021-03-05  18

String Object

The string Object is buy to work with text.

The String Object's Properties and Methods Are Described Below:

NN: Netscape, IE: Internet Explorer

PROPERTIES

Syntax: Object.property_name

PropertyDescriptionnnieconstructor 44LENGTHRETURns The Number of Characters in A String23

Methods

Syntax: Object.method_name ()

MethodDescriptionNNIEanchor ( "anchorname") Returns a string as an anchor23big () Returns a string in big text23blink () Returns a string blinking2 bold () Returns a string in bold23charAt (index) Returns the character at a specified position23charCodeAt (i) Returns the Unicode of the character at a specified position44concat () Returns two concatenated strings44fixed () Returns a string as teletype23fontcolor () Returns a string in a specified color23fontsize () Returns a string in a specified size23fromCharCode () Returns the character value of a Unicode44indexOf () Returns the position of the first occurrence of a specified string inside another string. Returns -1 if it never occurs23italics () Returns a string in italic23lastIndexOf () 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 as a hyperlink23match () Similar to indexof and lastindexof, but this method Ret URNS the specified string, or "null"

, Instead of a numeric value44replace () Replaces some specified characters with some new specified characters44search () Returns an integer if the string contains some specified characters, if not it returns -144slice () Returns a string containing a specified character index44small () Returns a string as small text23split () Splits a string into an array of strings 44strike () Returns a string strikethrough23sub () Returns a string as subscript23substr () Returns the specified characters. 14,7 returns 7 characters, from the 14th character (starts at 0 ) 44substring () Returns the specified characters. 7,14 returns all characters from the 7th up to but not including the 14th (starts at 0) 23sup () Returns a string as superscript23toLowerCase () Converts a string to lower case23toUpperCase () Converts a String to upper case23var str = "w3schools is get!" Document.write (Str.Substr (2,6)) // SchoolDocument.write (Str.Substring (2,6)) // Scho

转载请注明原文地址:https://www.9cbs.com/read-38810.html

New Post(0)