suppose I have string like “this str1ng for test” now i want to check if character at position [i-1] and [i+1] are both alphabet but character at [i] is number, like this example in word “str1ng” then character at position [i] replaced by appropriate alphabet.
or vice versa.
I need this for post processing for output of OCR. TQ
NSStringare immutable, so you’ll have to create a new NSMutableString from it, and mutate this copy, or to allocate aunichar*buffer, copy data from the NSString, perform the correction, and then recreate a newNSStringfrom the result. Once you’re working on a mutable copy of the string, you can use whatever algorithm you want.So you’ll need to have a function like that: