Convert the character into ASCII value and Convert ASCII value to character

Convert the character into ASCII value and vice verse

& Convert the ascii value to character

My goal is to achieve the increment between the letters like A to B, B to C, C to D

So i choose go with following PSEUDO CODE

  1. Convert Char of the given string ( Say 'A' in this case)
  2. Convert the char to ASCII value ( A to 65)
  3. Increment the ASCII value by 1 ( 65 + 1 = 66)
  4. Convert the ASCII value to character (66 to B)

Here you go, for the code

Convert.ToChar(System.Text.Encoding.ASCII.GetBytes(Convert.ToChar(strGivenCharacter)(0) + 1)

Mission Accompolished... :)

No comments:

Post a Comment

Keep ur coding aside.. Relax for some time..