## Alphabet increment

0
Hi there, I'm trying to create an "autoletter” –microflow. So if I have a string containing the letter "A”, I want to change this into "B”. I cannot find how to do this, can anyone help me? Thanks!
8

I would opt for a JavaAction and implement a simple shift there. Maybe you can get some inspiration from here:

https://www.geeksforgeeks.org/caesar-cipher/

4

You could also store the alfabet in an 'AlfabetLetter’ entity with two parameters.

- Index

- Letter

Where the Letter A has Index 1, Letter B has Index 2, Letter C has Index 3 etc.

In your microflow retrieve the whole alfabet (and maybe sort just to be sure).

The next letter can then be found by finding the letter from the current String in the alfabet list.

So if your String is 'G’, search in the AlfabetLetter list for the AlfabetLetter object where \$Letter equals \$YourCurrentString. You now have found the AlfabetLetter object with Index '7’ and Letter 'G’. Lets call it 'currentLetter’

Then search in that list again, but this time search on the Index parameter. Now you search for the next index by looking for \$AlfabetLetter/Index = \$currentLetter/Index +1

Now you have found the next AlfabetLetter object with Index 8 and Letter H. Lets call it 'nextLetter’

Now change your own object where you have your string to \$nextLetter/Letter.

Now your string is 'H’, the next letter after 'G’.

Be sure to make a split somewhere so you dont start looking for the next letter when you reached letter Z.

3

Steps:
1: Create a string ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’
2: Use function Find to find substring in a string.

find(‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’, ‘D’)
return value: 3 (= <Index>)
!! If the return value is 25, there is no next letter

3: Add +1 to <Index> .
4: Use function substring to find the next letter.
substring (’ABCDEFGHIJKLMNOPQRSTUVWXYZ’ , <Index>, 1)
return value: ‘E’

Finally replace your string (‘D’) with the return value of step 4 (‘E’).

``````if \$Variable = 'A' then \$Variable = 'B'