![]() ![]() |
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Member
Join Date: Feb 2008
Posts: 1
|
Suppose i have a five digit number. How can i convert this number so that this number is divided into five parts and then separated by three blank spaces.
Suppose i have a number 12345 then i want output like that 1 2 3 4 5 |
|
|
|
|
#2 (permalink) |
|
Member
Join Date: Jun 2008
Posts: 6
|
Is this kind of a solution u are expecting ???
public static void main( String[] args ) { String s = "12345"; String result = ""; for ( int i = 0; i < s.length(); i++ ) { if ( result.length() > 0 ) { result += " "; } result += ( s.charAt( i ) ); } System.out.println( "Result is =>>> " + result ); } |
|
|
|
|
| Thread Tools | |
| Display Modes | |
|
|