I want to change "I" to "K" where "I" is a string.
I was trying to convert "I" to int and increment the value to 2 and again convert it to "K" in c#.
I could see the exception.
Please help me in achieving a solution
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 24, 2013, 8:02 AM
string s = "I";
s = new string(new char[]{(char)(s[0] + 2)});
Console.WriteLine(s); // K
This should also work:
s = ((char)(s[0] + 2)).ToString();
srinathPosted Apr 24, 2013, 10:26 AM