Grant
Grant

Reputation:

How to turn char a into b in vb.net

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

Answers (1)

Patrick McDonald
Patrick McDonald

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

Related Questions