Hello i have a problem that i don't know how to solve. The problem is that I even don't know how to google about it. I've already spent hours on the internet finding the solution, but didn't succeeded. The situation is like this:
I have String, lets say:
NSString *string = @"aąbcčdeęėfghiįjzž";
my result has to be like this:
NSString *string = @"aabccdeeefghiujzz";
So if you understood i have to do this:
replace ą with a
replace č with c
replace ė with e
replace ę with e
and so on..
Maybe anyone could help me? i have an answer but it's not very optimized, i am hoping for some more convenient solution.
Thanks in advance!
Let the frameworks do the conversion for you:
NSString *blah = @"aąbcčdeęėfghiįjzž";
NSData *data = [blah dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *newblah = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSLog(@"new: %@", newblah);
This logs:
new: aabccdeeefghiijzz
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With