I am working on a particular automation and part of the process needs to validate a payment history field. This field is currently 96 characters long in string format and contains payment history for a particular account. The string could contain any number 0-9 as well as certain letters representing different statuses. An example portion of a string could be β00001230000111222223334000Bβ and any combination.
The thing I need is to look at each individual character in a string and confirm that the following number is at most one more than the current one or is a letter/less than. So for example this string β00012301112β would be valid but β00012366600β would not since it can not go from 3 to 6 in one position.
What is an easy way to do this since it is in string format?
At first glance, a very crude solution: you could make chunks by splitting on 0 and/or letter clusters and check the condition for each chunk. If it doesnβt match, you can search the chunk position.
import System.Text.RegularExpressions
Assign (Array Of String) chunks = Regex.Split(chain, "[0A-Z]+")