![]() |
|
|
Published: Saturday, October 24, 1998
The String Operators ***************************************************************** Most likely we have all used some of the VBScript string functions, such as InStr, Mid, Left, and Right. There are more string functions which developers are often less familiar with. This email discusses a few of those built-in string functions that get little mention, but are powerful functions nevertheless:
StrComp(string1, string2[, compare]) * A 0 means a binary comparison (You can define constants vbBinaryCompare to equal 0, and vbTextCompare to equal 1. Doing this will make your code more readable.)
Dim Name1, Name2, CompareValue
*****************************************************************
StrReverse(string1)=================== StrReverse simple reverses the character order of string1.
Dim BackwardsString
*****************************************************************
InStrRev(string1, string2[, start[, compare]])
===============================================This function is similar to InStr in that it takes similar parameters, just not in the same order. InStrRev is also like InStr in that it returns the position where the substring string2 is found within string1. Unlike InStr, though, InStrRev finds the first occurance of string2 within string1 BEFORE the start position. (Note, if start is omitted, the search starts at the end of string1. Compare is the same as the compare above, where 0 represents a binary comparison, and 1 a textual comparison.) Let's look at some code:
Dim SearchString, SearchChar, WhereAt
***************************************************************** ***************************************************************** To subscribe to WebDaily, point your browser to: http://www.4GuysFromRolla.com/webtech/webdaily ***************************************************************** ***************************************************************** Please forward this information to a friend, including the subscription URL! Happy Programming!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|