Home All Groups Group Topic Archive Search About

Checking strings are alphanumeric

Author
7 Feb 2006 4:57 PM
Oenone
Is there a nice .NET framework function that will allow me to easily check
if a string contains only alphanumeric characters?

Or is the only way to loop through the characters, checking each one
individually?

TIA,

--

(O)enone

Author
7 Feb 2006 5:08 PM
Herfried K. Wagner [MVP]
"Oenone" <oen***@nowhere.com> schrieb:
> Is there a nice .NET framework function that will allow me to easily check
> if a string contains only alphanumeric characters?
>
> Or is the only way to loop through the characters, checking each one
> individually?


Check out the 'Like' operator and/or
'System.Text.RegularExpressions.IsMatch'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>