Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Banketeshvar NarayanRank #235 · 10.5K reputationPosted Nov 13, 2015, 7:43 AM EST
Hi,
you can use
Char.IsLetter Method (Char)
Char.IsNumber Method (Char)
Char.IsLetterOrDigit Method
https://msdn.microsoft.com/en-us/library/yyxz6h5w%28v=vs.110%29.aspx
https://msdn.microsoft.com/en-us/library/yk2b3t2y%28v=vs.110%29.aspx
https://msdn.microsoft.com/en-us/library/system.char.isletterordigit%28v=vs.110%29.aspx
Please mark as answer if it helps you
Ravi PatelRank #439 · 5.7K reputationPosted Nov 13, 2015, 7:44 AM EST
Banketeshvar NarayanRank #235 · 10.5K reputationPosted Nov 13, 2015, 7:55 AM EST
Complete code is
static void Main(string[] args)
{
string skypeId = "bnarayan123";
foreach (var c in skypeId.ToCharArray())
{
if (Char.IsLetter(c))
{
Console.WriteLine("{0} is letter", c);
}
else if (Char.IsDigit(c))
{
Console.WriteLine("{0} is digit", c);
}
}
}
gauss kada4 reputationPosted Nov 13, 2015, 8:00 AM EST
Banketeshvar NarayanRank #235 · 10.5K reputationPosted Nov 13, 2015, 8:02 AM EST
Please accept my answer if it helps you.