String function example of asp

Source: Internet
Author: User
Tags function examples lowercase rtrim trim
String function example of asp
Use string functions to intercept, remove, and replace uppercase and lowercase strings.
Function syntax
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:
Dim MyString
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:
Dim MyVar
MyVar = LTrim ("vbscript") 'myvar contains "vbscript ".
MyVar = RTrim ("vbscript") 'myvar contains "vbscript ".
MyVar = Trim ("vbscript") 'myvar contains "vbscript ".
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.