JavaScript: String

Các khóa học qua video:
Python SQL Server PHP C# Lập trình C Java HTML5-CSS3-JavaScript
Học trên YouTube <76K/tháng. Đăng ký Hội viên
Viết nhanh hơn - Học tốt hơn
Giải phóng thời gian, khai phóng năng lực

The String object allows you work with many data types; it finish the primitive data type JavaScript string with some methods of helper.

Since JavaScript auto transform between primitive functions and String objects, you can call any helper methods of String object on each primitive string.

Using following syntax to create String object:

var val = new String(string);

string parameter is a string of characters that properly encoded. String.

String properties

The following is list of properties of String object and it's description.

constructor

Return a reference to String function created object.

length

Return length of the string.

prototype

Prototype property allows you add properties and methods to object.

String methods

Below is a list of available methods in String object and their descriptions.

charAt()

Return a character at specify position.

charCodeAt()

Return a number presentation Unicode value of character at index position.

concat()

Concatenating two strings and return a new composition string.

index()

Return index in String object at the first result of specific value or return -1 if does not find.

lastIndexOf()

Return index in String object at the last finding of specific value or -1 if not found.

localeCompare()

Return a number show a reference string to before or after or same to current string with ordered by.

match()

Being used to match between a regular expression and a string.

replace()

Being used to search the match result between regular expression and to replacing substring match with new substring.

search()

Searching equivalent between a regular expression and current string.

slice()

Extracts a part of the string and return a new string.

split()

Splits a String object to an string array by its substring parameter.

substr()

Return a string of characters from specified position with number of characters wanted to get.

substring()

Return a string of characters between tow specified indexes.

toLocaleLowerCase()

Converts all of characters of string to lower case characters with current locale.

toLocaleupperCase()

Converts all of characters of string to upper case characters with current locale.

toLowerCase()

Converts all of characters of string to lower case characters.

toString()

Return a string representation for specified object.

toUpperCase()

Converts all of characters of string to upper case characters.

valueOf()

Return the primitive of specified object.

» Tiếp: Các phương thức mới của String
« Trước: Mảng (Array)
Các khóa học qua video:
Python SQL Server PHP C# Lập trình C Java HTML5-CSS3-JavaScript
Học trên YouTube <76K/tháng. Đăng ký Hội viên
Viết nhanh hơn - Học tốt hơn
Giải phóng thời gian, khai phóng năng lực
Copied !!!