Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Identifying alpha vs. numeric characters in a string
Message
From
10/01/2007 19:08:05
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01184388
Message ID:
01184410
Views:
16
This message has been marked as the solution to the initial question of the thread.
>I am trying to check certain characters in a string in order to determine whether they are alpha or numeric characters. In FoxPro, I would convert the character to it's ascii value and check to see if the number returned was in the range of the alphabet characters or in the range of numbers 0-9. How would I accomplish that in C#?
>
>I thought I posted this question yesterday but can't seem to find it.
>Please forgive me if it's a rerun.
>
>Thanks.
>
>Linda

You can use Char structure's IsDigit,IsLetter, IsLetterOrDigit ... methods. ie:

bool isalpha = Char.IsLetter('c');
bool isdigit = Char.IsDigit("128 St.",2);
bool isspace = Char.IsWhiteSpace("128 St.",3);
bool ispunc = Char.IsPunctuation("128 St.",3);
bool isalphanum = Char.IsLetterOrDigit('\n'); // IsControl

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform