I have a need to replace a portion of a string with another string when there may be more than one instance of the target string in the original string. For example, I may have a string like “The fourth hour of the fourth day of the fourth month of the fourth season…” and I want to replace the second “fourth” with “fifth” so that the resulting string is “The fourth hour of the fifth day of the fourth month of the fourth season…” Currently, I have to laboriously parse and separate the string and rebuild it.
With all of the String.Replace… methods in Xojo, what I would really like is a String.ReplaceAt method that takes a ‘findString’, a ‘replaceString’, and an ‘instance’ integer.