Detailed description of the WordPress custom object

Source: Internet
Author: User
● Custom object ●

Note: An object name starting with "my" indicates an instance of the custom object.
If the = sign is added before the function name, the function returns a value.

1. Basic Object ):
New object ([expression])
Object (expression)
Defines an object and uses the expression value as the original value.

= Myobject. tostring ([radix_num])
Convert the original value of myobject to a string and return the result (without modifying the original value). If the original value is numeric, radix_num indicates the hexadecimal format when the original value is converted to a string.

= Myobject. valueof ()
Returns the original value (original type) of myobject ).

2. Type object (number, Boolean, string ):
That is to say, the effect of the defined object is equivalent to that of assigning the corresponding value to the variable directly (direct assignment can also call the object member function ).
New number (expression)
Defines a numeric object whose value is the value after expression is converted to a numeric value.

= Mynumber. tostring ([radix_num])
Convert the value of mynumber to a string in the format of radix_num (10 by default ).
Does not change ).

= Mynumber. valueof ()
Returns the original value (original type) of mynumber ).

New Boolean (expression)
Defines a Boolean object, whose value is the value after expression is converted into a Boolean object.

= Myboolean. tostring ()
Convert the value of myboolean to a string (that is, "true" or "false") and return the result (myboolean does not change ).

= Myboolean. valueof ()
Returns the original value of myboolean (original type ).

New String (expression)
Defines a String object whose value is the value after expression is converted into a string.
String object member variables:
Mystring. Length String Length (read-only)
Current first line number of the text field corresponding to the mystring. Scroll string
Maximum available first line number of the text field corresponding to the mystring. maxscroll string (read-only)

= Mystring. charat (Num)
Returns the character with the serial number num in mystring. For example, string ("ABC"). charat (2) returns 'C '.

= Mystring. charcodeat (Num)
Returns the ASCII value (16-bit) of the character num in mystring ).

= Mystring. indexof (expression, [begin_num])
Convert expression to a string and start searching for the begin_num (0 by default) character in mystring. The first position sequence number is returned. If no value is found, the first position sequence number is returned. If no value is found,-1 is returned.

= Mystring. lastindexof (expression, [end_num])
Convert expression into a string and start searching back for the character whose order is end_num (the default is the serial number of the last character of mystring) in mystring. The first position serial number is returned, -1 is returned if no value is found.

= Mystring. tolowercase ()
Converts all uppercase letters in mystring to lowercase letters and returns the result (mystring does not change ).

= Mystring. touppercase ()
Converts all lowercase letters in mystring into uppercase letters and returns the result (mystring does not change ).

= Mystring. Concat (expression1,..., expressionn)
Convert expresion1. .. expressionn into a string and add it to mystring (mystring does not change). The added string is returned.

= Mystring. Slice (begin_num, [end_num])
Extract the child string (excluding end_num) from the string number begin_num to end_num (the default length is mystring) in mystring ). Begin_num and end_num are negative numbers that are counted back from the last character. For example, string ("1234567"). Slice (-5, 6) returns "3456 ".

= Mystring. substr (begin_num, [num])
Truncates the substrings starting from the Character Sequence Number in mystring and starting from begin_num. If num is not specified, it indicates the substrings starting from begin_num to the end of mystring. Begin_num indicates the serial number that is reversed from the last character.

= Mystring. substring (begin_num, [end_num])
Extract the child string (excluding end_num) from begin_num to end_num (the default length is mystring) in mystring ). If begin_num is less than 0, 0 is used. If begin_num is greater than end_num, the two are swapped and then processed.

= Mystring. Split (char)
The character char is used as the separator to understand mystring and split it into a string array to return the result. If char is empty, mystring is split into one character and one character. For example, string ("123.234.345.12"). Split ('.')
Returns an array ["123", "234", "345", "12"].

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.