VBScript string method

Source: Internet
Author: User
Method Description Parameter passing example Result
ASC (String) Returns the ASCII code of the first character, which is equivalent to string. charcodeat of Js. "Alpha" 65
CHR (Charcode) Returns the corresponding letter, which is equivalent to the string. fromcharcode of Js. 65 A
CSTR (Expression) Converts an expression to a string type. 5 + 5 10
Instr ([Start,]String,Substring) Returns the position where the substring first appears in the string. Equivalent to the JS indexof "Two words", "W"
3, "two words", "W"
2
5
Rev (String,Substring[,Start]) Returns the position where the substring first appears in the string. The search starts from the end of the string, but the returned position is counted from the start of the string, which is equivalent to the lastindexof of Js. & Quot; 1234567890123 & quot;, & quot; 3 & quot"
& Quot; 1234567890123 & quot;, & quot; 3 & quot;, 5
13
3
Join (Stringarray[, Delimter]) Converts a string array to an array. delimter is the delimiter. By default, it is a space character, which is equivalent to the join of the array method in Js. Array ("one", "two", "three ")
Array ("one", "two", "three "),"*"
One two three
One * Two * Three
Lcase (String) Converts a specified string to lowercase. Similar to JS tolowercase "Lowercase" Lowercase
Left (String,Number) Returns a specified number of characters from the left of the string, a bit like the substr method of Js. "Left nine characters.", 9 Left nine
Len (String) Returns the length of a string. "This string is 34 characters long ." 34
Ltrim (String) The trimleft method of Firefox removes spaces starting from the string. "No leading spaces ." No leading spaces.
Mid (String,Start[,Length]) Returns a specified number of characters from the string. The usage is similar to that of the JS slice. "This is the middle of the string.", 13
"This is the middle of the string.", 13, 6
Middle of the string.
Middle
Replace (String,A,B) Replace all substring A in string with substring B, which is similar to the replace method in Js. "These characters are the right ten.", 10 Right ten.
Rtrim (String) Remove the white space on the right, which is the trimright method of Firefox. "No trailing spaces ." No trailing spaces.
Space (Number) Returns a string consisting of a specified number of spaces. 10
Split (String[, Delimter]) Splits the actual string into an Array Using delimiters. By default, it is a space character. "How now brown cow? "
"How now, brown cow? ",","
Array ("how", "now", "brown", "cow? ")
Array ("How now", "brown cow? ")
Strcomp (String1,String2) Compares two strings and returns a value indicating the comparison result. Returns 1, 0,-1, indicating that the value is greater "Beta", "Alpha"
"Alpha", "Alpha"
"Alpha", "Beta"
1
0
-1
Strreverse (String) Returns a string. ". Redro esrever Ni gnirts tupni EHT Si siht" This is the input string in reverse order.
String (Number,Charcode) Returns a string containing repeated characters of the specified length. 10, 65 Aaaaaaaaaa
Trim (String) Remove the gaps at both ends, that is, the JS trim method. "No leading or trailing spaces ." No leading or trailing spaces.
Ucase (String) Converts all the letters in uppercase, which is equivalent to the JS touppercase. "Uppercase" Uppercase

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.