|
-
November 28th, 1999, 12:53 PM
#1
how to search a string character by character
Hi everyone,
Need to be able to search a string and compare each character to a list of valid characters.
example:
string1="vb-programming"
string2="vb=programming"
valid characters are a-z, A-Z, 0-9, _, -, .
this would find all these characters valid in string1 to be valid and find "=" in string2 to be invalid thus making that string an invalid string
any help or direction would be appreciated
btw i have been trying to use instr functions to accomplish this and have only been able to search
for "1" character at a time 
thx harold
-
November 28th, 1999, 12:54 PM
#2
Re: how to search a string character by character
sorry but the category should not be activex, should be controls or misc
-
December 1st, 1999, 06:24 PM
#3
Re: how to search a string character by character
public Function ValidString(byval sInput as string) as Boolean
Dim iLen as Integer
Dim iCtr as Integer
Dim sChar as string
iLen = len(sInput)
for iCtr = 1 to iLen
sChar = mid(sInput, iCtr, 1)
If Not sChar Like "[0-9A-Za-z_]" And sChar <> "-" then Exit Function
next
ValidString = true
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|