What are some different ways I can modify a string holding ssn so that
123-45-8999 becomes XXX-XX-8999 ?
Must use string member functions to accomplish this.
Thanks!
What are some different ways I can modify a string holding ssn so that
123-45-8999 becomes XXX-XX-8999 ?
Must use string member functions to accomplish this.
Thanks!
Try replace
:
std::string s = "123-45-8999";
s.replace(0, 6, "XXX-XX");
If the field widths are dynamic, you can combine this idea with the string tokenization we did just earlier to get something more flexible.