Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only allow keyboard characters in a string?

Status
Not open for further replies.

AntunB

IS-IT--Management
Aug 11, 2003
263
AU
Ok how would i get a string, and if it contains non keyboard characters discard it?

so if it contains ascii <32 and >126 discard it?????

so i have a word "HEY" it should be ok, but if i have a word "þoo" its not ok, because the first character is ascii 999

so it would need to check every characher in the string

Thanks?
 
Take a look at the For ... Next instruction and at the Len, Mid, Asc functions.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hey thanks made sumthing

Code:
For j = 1 to Len(arr(i))
	If Asc(Mid(arr(i), j, 1)) >126 Then
		'do some stuff
	End If
Next
 
tmp = ""
For j = 1 To Len(arr(i))
x = Mid(arr(i), j, 1)
If Asc(x) >= 32 And Asc(x) <= 126 Then
tmp = tmp & x
End If
Next
arr(i) = tmp

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top