xcode - iPhone: How do I convert a string with a currency symbol to a negative number? -


I have a string that is £ 23.56 or $ 23.56, how can I convert it to -23.56?

I have this part

  NSMutableString * strAmount = [NSMutableString stringWithString: txtAmount.text]; [Straima replaced substitutionchanges: [Stormate range offstring: Strakurense symbol] with string: @ ""];  

Although it looks like a good start, make a set of currency symbols You can then use rangeOfString: instead of rangeOfCharacterFromSet: . Your code might look like this:

  NSMutableString * strAmount = [NSMutableString stringWithString: txtAmount.text]; NSCRCRARSetset * MoneySat = [NSCRactorArt CharacterSat Waters ActorsInstring: @ "$ €"]; [Stranat's place Chinaters streak: [Stormount Rangeoff Chaugher Fraset: Musset] with string: @ "-"];  

Comments