Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
String function example of asp
Use string functions to intercept, remove, and replace uppercase and lowercase strings.
Len (string | varname) returns the number of characters in the string or the number of bytes required to store a variable.
Trim (string) removes spaces before and after the string
Ltrim (string) removes spaces before the string
Rtrim (string) removes spaces after the string
Mid (string, start, length) gets the length string starting from the start character of the string. If the third parameter is omitted, it indicates the string starting from the start character to the end of the string.
Left (string, length) gets the length string from the Left side of the string.
Right (string, length) gets the length string from the Right side of the string.
LCase (string) converts all uppercase letters in the string to lowercase letters.
UCase (string) converts all uppercase letters in the string to uppercase letters.
StrComp (string1, string2 [, compare]) returns the comparison result between the string1 string and the string2 string. If the two strings are the same, 0 is returned. If the two strings are less than 1,-1 is returned, if the value is greater than 1, 1 is returned.
InStr (string1, string2 [, compare]) returns the position where the string1 string first appears in the string2 string.
Split (string1, delimiter [, count [, start]) splits a string into one-dimensional arrays based on delimiter. delimiter is used to identify the substring boundary. If omitted, use space ("") as the separator.
Count returns the number of substrings.-1 indicates that all substrings are returned.
Start is 1. If it is 0, or the binary comparison is omitted.
Replace (expression, find, replacewith [, compare [, count [, start]) returns a string, where a specified number of substrings (find) replacewith ).
1. Len function example:
The following example uses the Len function to return the number of characters in a string:
MyString = Len ("VBSCRIPT") 'mystring contains 8.
2. Trim, Ltrim, and Rtrim function examples:
The following example uses the LTrim, RTrim, and Trim functions to remove the leading space, trailing space, starting space, and trailing space of a string:
MyVar = LTrim ("vbscript") 'myvar contains "vbscript ".
MyVar = RTrim ("vbscript") 'myvar contains "vbscript ".
MyVar = Trim ("vbscript") 'myvar contains "vbscript ".
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.