If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > Separates variable by spaces

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-13-10, 16:17
bolanta48 bolanta48 is offline
Registered User
 
Join Date: Feb 2010
Posts: 4
Separates variable by spaces

Hi!

I'm new to Java, so I don't have to much experience with Java. This is a basic question, I want to know how separate a variable by spaces. For example:
you have 1234, so the program should print 1 2 3 4. I'm not very good with english, so I tried to ask as well as I could. If you know how, please tech me how, Thnks is advance.
Reply With Quote
  #2 (permalink)  
Old 08-20-10, 00:43
Al_RelEZ_Al Al_RelEZ_Al is offline
Registered User
 
Join Date: Aug 2010
Location: Sydney
Posts: 15
Java Developer here

Hi bolanta48,

I'm a Java Developer and I think for something like that you need to be clear with what your outcomes/test cases are.

For example, will you ALWAYS have a single digit number spat out from the string?
ie 12345 will give 1 2 3 4 5
not 12 3 45

And will your inputs ALWAYS be numbers?

If you're always going to have single digit outputs, I'd suggest just converting the number into a String or char[] and then using a char walker.

Anyway... my 2cents
Reply With Quote
  #3 (permalink)  
Old 08-20-10, 13:43
Donnellsigns Donnellsigns is offline
Registered User
 
Join Date: Aug 2010
Posts: 1
I agree bolanta48. and since this is my first tine on JAva. I suggest that you go to other threads as well. and thank you to your suggestion, I really appreciate it.
Reply With Quote
  #4 (permalink)  
Old 08-24-10, 13:28
bolanta48 bolanta48 is offline
Registered User
 
Join Date: Feb 2010
Posts: 4
Quote:
Originally Posted by Al_RelEZ_Al View Post
Hi bolanta48,

I'm a Java Developer and I think for something like that you need to be clear with what your outcomes/test cases are.

For example, will you ALWAYS have a single digit number spat out from the string?
ie 12345 will give 1 2 3 4 5
not 12 3 45

And will your inputs ALWAYS be numbers?

If you're always going to have single digit outputs, I'd suggest just converting the number into a String or char[] and then using a char walker.

Anyway... my 2cents
Thanks Al_RelEZ_Al,

The program should output any digits; 1234, 2343, 4533. The important is how to separate by spaces.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On