I'm doing a phone number conversion program.

I created a method to convert the letter to numbers, and a method to format the phone number(dashes after 3 and 6 numbers).
Both methods return a value.

I don't want to post the entire program, but the calling method in the main would look like

String conversion = Conversion(singleC); //singleC is every single character
String format = Reformat(characters);    //characters is the input

So how do I print the final result that use the two methods above?

This is my first post..so sorry if I violate any rules...and for my grammar errors if there are any..Thanks!

7 Years
Discussion Span
Last Post by group256

I hope I didn't misunderstand your question, but what I think is that you can't do that. You want to convert 123-123456-12 into numbers which is not a number. It is a string, as '-' is not a digit.

So, you can add - to your string and then save it as a string. Although if you need to have the number, you can later on convert them into digits, extract digits and get rid of the '-'.


close thread..problem solved...sorry for the misunderstanding in the first post.


If I understood your problem correctly, you want to convert a given character to create a phone-number. The number is the number associated with that character in a cellphone keypad?? Is that correct??

For example, you want to convert blurXposter to 258-797678-37??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.