-
- C # address bar controls for memory functions
- Description C # Call an external process
- C # how to manipulate database transactions
- Overview C # Language Exception Handling
- A Brief Introduction to C # arrays and functions
Lenlen (string | varname) returns the number of characters in the string or the number of bytes required to store a variable.
Trimtrim (string) removes spaces before and after the string
Ltrimltrim (string) removes spaces before the string
Rtrimrtrim (string) removes spaces after the string
Midmid (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.
Leftleft (string, length) gets the length string from the left side of the string.
Rightright (string, length) gets the length string from the right side of the string.
Lcaselcase (string) converts all uppercase letters in the string to lowercase letters.
Ucaseucase (string) converts all uppercase letters in the string to uppercase letters.
Strcompstrcomp (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.
Returns the position of the string1 string in the string2 string for the first time.
Splitsplit (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.
Replacereplace (expression, find, replacewith [, compare [, Count [, start]) returns a string, where a specified number of substrings (FIND) replacewith ).
C # string functions 1. Len function example:
The following example uses the Len function to return the number of characters in a string:
Dim mystring = Len ("VBScript") ''mystring contains 8. C # string functions 2. trim, ltrim, and rtrim function examples:
The following example uses the ltrim, rtrim, and trim functions to remove spaces, trailing spaces, and,
Space at the beginning and end:
Dim myvar = ltrim ("VBScript") ''myvar contains" VBScript ". Myvar = rtrim ("VBScript") ''myvar contains "VBScript ". Myvar = trim ("VBScript") ''myvar contains "VBScript ". C # string functions 3. Mid function example:
The following example uses the mid function to return the six characters starting from the fourth character in the string:
Dimmyvar
Myvar = mid ("VB Script isfun! ",) ''Myvar contains" script ".
C # string functions 4. Left function example:
The following example uses the left function to return the three letters on the left of mystring:
Dim mystring, leftstring mystring = "VBScript" leftstring = left (mystring, 3) '''leftstring contains "vbs C # string function Daquan 5. Right function example:
The following example uses the right function to return a specified number of characters from the right side of the string:
Dim anystring, mystr anystring = "Hello World" ''defines the string. Mystr = right (anystring, 1) ''returns" D ". Mystr = right (anystring, 6) ''returns" world ". Mystr = right (anystring, 20) ''returns" Hello World ". C # string functions 6. lcase function examples:
The following example uses the lcase function to convert uppercase letters to lowercase letters:
Dim mystring dim lcasestring mystring = "VBScript" lcasestring = lcase (mystring) ''lcasestring contains "VBScript ".
C # string functions 7. ucase function examples:
The following example uses the ucase function to return the string in uppercase:
Dimmyword
Myword = ucase ("helloworld") ''returns" helloworld ".
C # string functions 8. strcomp function examples:
The following example uses the strcomp function to return the result of string comparison. If the third parameter is 1, text comparison is executed. If the third parameter is 0, binary comparison is executed.
Dimmystr1, mystr2, mycomp
Mystr1 = "ABCD": mystr2 = "ABCD" ''defines the variable.
Mycomp = strcomp (mystr1, mystr2, 1) ''returns 0.
Mycomp = strcomp (mystr1, mystr2, 0) ''returns-1.
Mycomp = strcomp (mystr2, mystr1) ''returns 1.
C # string functions 9. instr example:
The following example uses instr to search for strings:
Dimsearchstring, searchchar, Mypos
Searchstring = "xxpxxpxxpxxp"
Searchchar = "P"
Mypos = instr (searchstring, searchchar) ''returns 9.
Note: The returned result is not the first occurrence of a character string in another string, but the byte position.
C # string functions 10. Example of split functions:
Dimmystring, myarray, MSG
Mystring = "vbscriptxisxfun! "
Myarray = Split (mystring, "X",-1, 1)
''Myarray (0) contains "VBScript ".
''Myarray (1) contains "is ".
''Myarray (2) contains "fun! ".
Response. Write (myarray (0 ))
C # string functions 11. replace function examples:
Replace ("ABCD", "BC", "12") ''To get a12d
[Edit recommendations]