I
ineedyourluvin1
Hello all! I've been looking for a way to strip characters from strings
such as a comma. This would be great for using a comma
as a delimiter. I show you what I have right now.
#include<iostream>
#include<string>
int main(int argc, char *argv[])
{
using namespace std ;
char people[14] = "Me,Myself,I" ;
char nocommas[14] ;
int i, j ;
i=j=0 ;
for(i = 0; i < 14; i++){
if(people != ',')
nocommas = people ;
if(people == ',')
nocommas = ' ' ;
}
cout << "With commas : " << people << endl ;
cout << "Without commas : " << nocommas << endl ;
cout << "\n\n\n\n" ;
cout << "\tNow tell me how I can store each name in a separate
variable ?" << endl ;
cout << "\tAnd can someone show me how to do this with string instead
of char[] ?" << endl ;
cout << "\t\t Thanks so much!" << endl ;
return 0 ;
}
so as you can see it strips commas and puts a space in its place.
Thanks for you help
such as a comma. This would be great for using a comma
as a delimiter. I show you what I have right now.
#include<iostream>
#include<string>
int main(int argc, char *argv[])
{
using namespace std ;
char people[14] = "Me,Myself,I" ;
char nocommas[14] ;
int i, j ;
i=j=0 ;
for(i = 0; i < 14; i++){
if(people != ',')
nocommas = people ;
if(people == ',')
nocommas = ' ' ;
}
cout << "With commas : " << people << endl ;
cout << "Without commas : " << nocommas << endl ;
cout << "\n\n\n\n" ;
cout << "\tNow tell me how I can store each name in a separate
variable ?" << endl ;
cout << "\tAnd can someone show me how to do this with string instead
of char[] ?" << endl ;
cout << "\t\t Thanks so much!" << endl ;
return 0 ;
}
so as you can see it strips commas and puts a space in its place.
Thanks for you help