On Tue, 24 Jul 2007 22:44:03 +0200, seema <se***@discussions.microsoft.comwrote:
Hi,
I have a string strA = "12 MyAddress"
strB = "Your Name"
I want to get the first char of string and want to know weather it is
integer between 1-9 or char between A-B.
How can I do that.
Thanks
Lot of different ways to do this, and one of them is by creating a lookup table with the specific values and compare the first character of eachstring against this table.
List<chartable = new List<char>(new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B' });
string strA = "12 MyAddress";
string strB = "Your Name";
if(table.Contains(strA[0]))
{
}
if(table.Contains(strB[0]))
{
}
--
Happy coding!
Morten Wennevik [C# MVP]