Reputation:
Hi i am trying to increment a char in vb.net, eg: Dim letter As Char = "a"c. and i want to make it b, and so on. how can i do this?
Upvotes: 4
Views: 4136
Reputation: 65471
You could get the ascii code, increment, and convert back to Char:
Chr(Asc(letter) + 1)
The Unicode version of this is:
ChrW(AscW(letter) + 1)
EDIT:
As Glen pointed out, you need to be careful if you are trying to increment "z"c
Upvotes: 7