on 2009 Nov 16 10:05 AM
Hi,
i am getting string value like this :
name john company
test1 position director sal
45000
i am getting this value in a string.
i want to display the value like below :
name john
company test1
position director
sal 45000
how to proceed on this ? can we use new line character here ? how can we use that? pls suggest me on this.
Regards,
Pavani
Hi Friend,
you can use the split method of String. to split that string base on space.
for Example
String st = "Jeetendra Kumar Choudhary";
String[] string = st.split(" ");
for (int j = 0; j < string.length; j++) {
System.out.println(string[j]);
}
By this way you can get the each word separately and you can concatenate it again in single string.if you need it.
Regards
Jeetendra.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pavani,
Yeah newline character can always be used whenever you are using textview or textedit in Web Dynpro as the formatting is enabled here.
What you can do in this case is store the value in a string and match all the characters of the string by progressive index for "\n" and then split the string into array of strings. Now append "\n\n" to all the different string array elements to increase the spacing by one more line. You can use string buffer for ease.
Regards,
Tushar Sinha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
73 | |
10 | |
9 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.