String - Replace Letters With Numbers

Hello,

I have a bunch of 2 character strings, and I want to check if it contains a letter, and replace it with a number. Here is an example of the strings that I get:

  • 00
  • 01
  • G9
  • A3
  • 44

The list of strings could contain a letter. I want to replace that with a number like so:

  • A = 1
  • B = 2
  • C = 3
  • D = 4, etc

I already have a function that returns the number corresponding to the letter position within the alphabet. I just need to be able to check if the string has a character, and to replace only just that character. Example:

var thisString : String = 4F

thisString does contain ‘F’, replace with Function ReplaceAlphabet() → returns 6.

Thus thisString = 46.

Cheers,
Ollie

Hum, turns out I could do it like this:

thisString = thisString.Replace("A", "0");
thisString = thisString.Replace("B", "1");
thisString = thisString.Replace("C", "2");