cancel
Showing results for 
Search instead for 
Did you mean: 

how to use new line character?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (1)

Answers (1)

Former Member
0 Kudos

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