M
Michael R. Copeland
What is a good way to delete 1 character (or several) from a
character array that's being processed as a "string"? Specifically, I
have something like:
char szWork[128];
....
strcpy(szWork, "-1234.5"); // populate the data
At this point, I'd like to remove the '-' that's in the 1st character
position (and this example isn't realistic), and I can't see a good way
to do this: strcpy with a char pointer that points to the 2nd character;
memmove; I don't know...
Furthermore, it might be desireable to remove more than 1 character -
and from within the string's contents. I'd want to extend the
particular problem above to do that, as well.
This seems such a common operation (editors, data conversions, etc.),
that I find it odd I can't find examples (on google, etc.) of how to do
this.
I suppose I could use std::string or some advanced "string"
processing (and I don't know what to use there, either), but that seems
pretty extreme for this.
Any thoughts? TIA...
character array that's being processed as a "string"? Specifically, I
have something like:
char szWork[128];
....
strcpy(szWork, "-1234.5"); // populate the data
At this point, I'd like to remove the '-' that's in the 1st character
position (and this example isn't realistic), and I can't see a good way
to do this: strcpy with a char pointer that points to the 2nd character;
memmove; I don't know...
Furthermore, it might be desireable to remove more than 1 character -
and from within the string's contents. I'd want to extend the
particular problem above to do that, as well.
This seems such a common operation (editors, data conversions, etc.),
that I find it odd I can't find examples (on google, etc.) of how to do
this.
I suppose I could use std::string or some advanced "string"
processing (and I don't know what to use there, either), but that seems
pretty extreme for this.
Any thoughts? TIA...