How to get next letter in alphabets

Hi All,

I have mainframe screen field name “POC” bot need to read that field value and enter next letter in alphabets.

Example POC value is “g”
Bot need to enter “h”

How to do this can some one help me.

Regards,
Hima

@thima

First you need to find out the ASCII value of that character.

             Int value = Asc("your input")
             value = value + 1

And then convert ASCII integer value back to character as below.

              Char newValue = Chr(value)

Here newValue is next letter of given alphabet.

4 Likes
char letter = 'c';

if (letter == 'z')
    nextChar = 'a';
else if (letter == 'Z')
    nextChar = 'A';

else
    nextChar = (char)(((int)letter) + 1);

Regards,
Arivu

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.