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

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

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 article has been dead for over six months. Start a new discussion instead.