0

I have the following array

char myArray[] = {"H4w6m1ny6pr4gr1mm2rs6d42s63t6t1k26t46ch1ng2616l3ght6b5lb?6N4n2,6th1t’s616h1rdw1r26pr4bl2m"}; and want to replace specific characters from it, H to 1, or all m's to J. I know I have to use a loop, but how do I do to replace multiple letters with whatever I want? I could go and myArray[0] = 'J' but replacing each position individually doesn't seem efficient to me. Any ideas?

Julio
  • 11
  • 1
  • 2
    Possible duplicate of [How to replace all occurrences of a character in string?](https://stackoverflow.com/questions/2896600/how-to-replace-all-occurrences-of-a-character-in-string) – Naman Sep 09 '17 at 18:55
  • Make an array of the from/to characters and loop over that array applying the technique in the linked question. – Retired Ninja Sep 09 '17 at 18:59
  • Thank you! That's pretty much what I need – Julio Sep 09 '17 at 20:42

0 Answers0