0

Hi to all

i have requirment like this the field length is 15 digits but am getting input only 6 digits..means i have to put spaces after the 6 digits position menas spaces after the value.how to do it in java,could u send the sample programe because i dont know java programing am new to java.

thanks in advance for ur replys

3
Contributors
2
Replies
3
Views
13 Years
Discussion Span
Last Post by vimal_parakhiya
0

Hi. I'm not quite sure what you mean. Could you post a code snippet of what you have?

Also post the input you expect to receive and what you wish to do with that input.


Ed

Hi to all

i have requirment like this the field length is 15 digits but am getting input only 6 digits..means i have to put spaces after the 6 digits position menas spaces after the value.how to do it in java,could u send the sample programe because i dont know java programing am new to java.

thanks in advance for ur replys

0

You can use following code

public class StringAppend{
public static void main(String args[]){
int n=10; // As u told , it is assumed that n contains max six digits

String str = n+" "; // converts numbers to string and appends a space

int sLen = str.length();
for(int i=1; i<=15-sLength; i++){ // Pad with spacing to make total size of 15
str = str+" ";
}

}

}

Hi to all

i have requirment like this the field length is 15 digits but am getting input only 6 digits..means i have to put spaces after the 6 digits position menas spaces after the value.how to do it in java,could u send the sample programe because i dont know java programing am new to java.

thanks in advance for ur replys

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.