I like coding, though I'm really stupid, and not very good at it. I'm having trouble figuring out how to remove spaces from a String. I'm such a noobie.. if anyone wants to take a few min to educate me i'd appreciate it.
The thing i was attempting to do with this mess of a code, was basically have the user type in a phone number, and the program will take what they typed in, and remove all spaces and symbols that were typed, and turn the numbers into one string..
so say you type 569-678-4567 or 569 678 4567
the program returns 5696784567
public static void main(String[] args) throws IOException
{
String s;
String number;
int i, j, k;
BufferedReader br = new
BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a phonenumber: ");
number = br.readLine();
System.out.print(number);
rev(number);
}
public static String rev(String number)
{
StringTokenizer st;
StringBuffer full = new StringBuffer();
st = new StringTokenizer(number, " -,.?!:;");
return st;
}
}
Sorry if it's really confusing..i just got a little help from a friend, and I had no idea what to do after they helped a little, so some things here probably don't make much sense..