How to use new line character?
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.
Similar Messages
-
How to insert new line character?
Hi all,
I have two lines to print.
out.println("Available number of columns="+cols);
out.println("Number of columns must be present=10");My problem is:
i want both the lines to be printed one below the other. But, it is displayed in one single line.....
Can anyone please tell me how to insert new line character?
I tried with \n, '\n' and \r\n but, in vain......
Thanks for your time.
Regards,
AshviniYou should never use "\n" directly.
The line separator character is different on different operating systems.
And putting quotes around it in your string will make absolutely no difference in the JSP.
To find out what the line separator is you should use System.getProperty("line.separator");
The JSPWriter and PrintWriter classes will automatically use this property with a println statement, so a println will always finish with a line separator.
The issue here was that HTML by default ignores all whitespace.
The solutions provided
- use a <br> tag instead of a carriage return
- use <pre> tags, which tells the browser not to ignore whitespace. That can be troublesome in JSP which generates a lot of extraneous carriage returns into the code.
Cheers,
evnafets -
How to remove new line character from query output?
Hi,
How to remove new line character from query output?
have tried select replace(column_name, CHR(10), ' ') from table_name.
Edited by: GreenHorn on Sep 11, 2008 12:53 AMPlease consider, that windows uses a sequence of chr13||chr(10) Unix uses only one character chr(10).
The new line character(s) may be OS-dependent.
You could consider both with:
replace(replace(column_name, CHR(13)||CHR(10), ' '),CHR(10),' ')
Hartmut
Edited by: hartmutm on 11.09.2008 01:32 -
Need help in how to print new line character in unix using java
Hi All,
I use the printstream class to print some line in a text using java.
here is the code:
FileOutputStream out; // declare a file output object
PrintStream p; // declare a print stream object
p.print("\t");
p.print(date);
p.print("\t\t");
p.print(RecCount);
p.println("\n");when i use this and output of this character in windows is
date RecCount
22-07-2007 23456
when i use the same code in unix it shows the following output:
date RecCount[]22-07-2007
it wont accept the new line character could any one give me an idea to solve this problem.PrintStream has a println() method. Use that. Or System.getProperty("line.separator").
Because a newline char doesn't necessarily specify a line break. It's system-dependent. -
ADF: how to insert new line character in column of VO?
Hi Everyone,
Im using Jdev 11G.
i have a VO with 5 columns displayed on the ADF page.(VO has total 8 columns)
1 column is the combination of 3 columns. i concatenated the 3 columns and added new line character after each column chr(13).
VO query is working very fine in Toad. the columnn displays each concatenated column value after a new line character but the same query is not working in ADF.
The column which is concatenating 3 columns and has to display with new line character is not displaying new line character its just concatenating the 3 values and displaying it on the page.
wat can be the solution for this in ADF?
Thank you.Setting escape="false" will allow putting html <BR> in the column and it will display ok however if your table allows export to excel the <BR> gets exported and displays as text in your exported file. Also & will export as & To prevent that, use your original text without the escape=false setting and insert LF or CR (10 or 13 character), then add inline style of white-space: pre-line; to column or to style class in your skin. That will cause all line feeds to wrap but will export to excel without mixing html in the export.
http://www.w3schools.com/cssref/pr_text_white-space.asp
Edited by: Don Kleppinger on Jan 14, 2013 4:06 PM -
How to write new line character to a file from textarea
Hi ,
I want to save the contents of textarea in a file.The textarea may contain new line characters,
I am getting the contents from the textarea using getText() method but after writing the contents to the file
it stores the entire text in a single line.But I want the text as it apperars in the textarea.
Please provide me a good solution.
-manimaybe this code samples are useful to your problem
File datatext = new File(fileName);
try {BufferedWriter writer =new BufferedWriter(new OutputStreamWriter(new FileOutputStream(datatext)));
writer.write(.......);
writer.newLine();
writer.close(); -
How to add new line character \n but cant
Hi,
Im trying to add some text and seperate with a \n but its not
doing it. Ive cut down my code to the below:
<html>
<head>
<title>test</title>
</head>
<body>
<script type="text/javascript">
document.write('wer\nsd');
</script>
</body>
</html>
But it doesnt work...can anyone please help?
ThanksRudei wrote:
> Hi,
> Im trying to add some text and seperate with a \n but
its not doing it. Ive
> cut down my code to the below:
>
> <html>
> <head>
> <title>test</title>
> </head>
> <body>
> <script type="text/javascript">
> document.write('wer\nsd');
> </script>
> </body>
> </html>
>
> But it doesnt work...can anyone please help?
>
> Thanks
>
this will work:
document.write('wer'+'\n'+'sd');
and this will *probably* work:
document.write("wer\nsd");
I just replaced single quotes with double quotes
seb ( [email protected])
http://webtrans1.com | high-end web
design
Downloads: Slide Show, Directory Browser, Mailing List -
Can we achieve new line character(\n) using xpath function??
All,
I want to use new line character for some text formating. Does xpath function supports new line character? If so, which function to use? If not, what is the alternative I can use to achive this?
Rgds
senHi Shine SS,
Had same requirement and your solution worked.
Thanks. -
New Line Character in SQL Query
Dear All,
I am wondering if some one tell me how to insert new line character in the SQL Query Output for example I need out put in the following format. Every line on new line.
The total count is:
Registration: 1111
Fees paid: 2222
Admission Done: 3333
Total:4000
Many thanksHi
SQL> select
2 'The total count is:
3 Registration: 1111
4 Fees paid: 2222
5 Admission Done: 3333
6 Total:4000
7 ' dummy_txt from dual
8 /
DUMMY_TXT
The total count is:
Registration: 1111
Fees paid: 2222
Admission Done: 3333
Total:4000
SQL>
SQL> select 'a'||chr(10)||'b' from dual;
'A'
a
b
SQL> T -
New line character is not working in BPEL 11g
I am trying to use new line character in string concat operation in BPEL 11g, but it is not giving new line in output. Any idea why?
We can achive this by embedding html tag break '< br >', something like below.
string('Please click on the URL below to login and open your invoice Worklist.< br >
< br >
<a href="http://localhost:8001/integration/worklistapp"> Invoice Worklist </a< < br <
< br >
Edited by: RaviOrnext on Aug 16, 2012 4:24 AM -
Want to know how to check for new line character in text file
Hi All,
I`m trying to read data from text file. However I`m not sure whether the data is in 1st line or nth line. Now I`m trying to read the text from the readline. But if text is "" and not NULL then my code fails. So I want to know how to check for new line character and go to next line to find the data. Please help.
Thanks
static int readandwriteFile(Logger logger,String filepath){
BufferedWriter out = null;
BufferedReader in = null;
File fr = null;
int get_count = 0;
try {
if(new File(filepath).exists())
fr= new File(filepath);
System.out.println("FileName: "+fr);
if(fr != null){
in = new BufferedReader(new FileReader(fr));
String text = in.readLine();
if(text != null){
get_count = Integer.parseInt(text);
in.close();
else{
get_count = 0;
else{
out = new BufferedWriter(new FileWriter(filepath));
out.write("0");
out.close();
} //Reading of the row count file ended.
catch(Exception e) {
e.printStackTrace();
finally {
try{ if (in != null) {
in.close();
if (out != null) {
out.close();
catch(Exception e) {
e.printStackTrace();
return get_count;
}You are calling the readline() only once which means you are reading only the first line from the file...
Use a loop (Do-While preferably)
do{
//your code
}while(text == "") -
How to add new line item using BAPI BAPI_CONTRACT_CHANGE for contract-ME32K
HI Experts,
how to add new line item using BAPI: BAPI_CONTRACT_CHANGE for existing contract.
Requirement:
Already the contract having two line items using ME31K.
Custom program has to add new line items in existing contract.
Thanks,
SendilI got the solution:
We can do like this:
1. Get all details using details, BAPI_CONTRACT_GETDETAIL.
2. After getting results, append new line item. Then use your BAPI.
Check this posting program.. where this bapi is used, use the same coding technique.
IDOC_INPUT_PURCONTRACT_CHANGE -
Problem: Problem
is occurring in docx format; it is not printing “New Line” character in extracted txt using IFilter (offfiltx.dll) while with doc file IFilter (OffFilt.dll) is working fine.
Environment: -
Operating
System:
Windows XP SP2/7
Language:
C#
MS
Office Version: - MS Office 2007/2010/2013
Problem
Description: -
We
havedocx
file with new line character, and we are processing this file in IFilter for extracting text, and it is giving output with concatenation of lines.
Docx
file format (Sample.docx)
Test this music
Word processing
Testing docx file
Output:
- Test this music Word processing Testing docx file
Requirement:
- We
have requirement to get following text in particular format with New Line from docx because client is using docx format only.
Test this music
Word processing
Testing docx file
Attempt:
We have tried a lot after changing IFilter configuration,
but it is not giving required output. Then we saved same file in doc format (Sample.doc), which is giving required output.
Because it is application specific problem, kindly
assist to resolve issue on priority. We are sharing IFilter paths for extracting text for doc and docx.
Doc Filter Location: - %systemroot%\system32\OffFilt.dll
Docx Filter Location: - <Drive>:\PROGRA~1\COMMON~1\MICROS~1\Filters\offfiltx.dll
Code Snippet for setting property of filter
internal static IFilter LoadAndInitIFilter(string fileName, string extension)
IFilter filter
= LoadIFilter(extension);
if (filter
== null)
return null;
IPersistFile persistFile
= (filter as IPersistFile);
if (persistFile
!= null)
persistFile.Load(fileName, 0);
IFILTER_FLAGS flags;
IFILTER_INIT iflags
=
IFILTER_INIT.CANON_HYPHENS
|
IFILTER_INIT.CANON_PARAGRAPHS
|
IFILTER_INIT.CANON_SPACES
|
IFILTER_INIT.APPLY_INDEX_ATTRIBUTES
|
IFILTER_INIT.HARD_LINE_BREAKS
|
IFILTER_INIT.FILTER_OWNED_VALUE_OK;
if (filter.Init(iflags,
0, IntPtr.Zero, out flags)
==IFilterReturnCode.S_OK)
return filter;
Marshal.ReleaseComObject(filter);
return null;
Kindly
assist to resolve this issue and also let us know if any input is required.
For any help, we would be really
thankful.Kindly
assist to resolve this issue and also let us know if any input is required.
For any help, we
would be really thankful. -
How to print new line in jsp page
hi
how to print new line in jsp page
thanks\n - new line character is in java specific not HTML
specific.Well, if the correct line separator sequence (by far not always \n) would be used, it does add a new line to the HTML output. Too bad that you don't want to see HTML but formatted text. The BR tag is a formatting element for the displayed text, not a line break in HTML. ;) -
How to insert new line in the copied schema with transaction code PE01?
Dear Experts,
I have copied HKT0 to ZKT0 , i want to insert new line between line 150 and line 160 in ZKT0, I don't know how to insert new line 160, who can tell me ?
Looking forward to your reply.
Best Regards,
MerryHi,
1. Open your schema,
2. In first colume "Line" select line where you want to add new line,
3. Replace first value in the column field (that indicates number of line) with character I (means insert),
4. Press enter
The line will be added. The same way you can add lines to PCR.
To delete use character D.
Cheers
Maybe you are looking for
-
Webdynpro application runtime error CX_FQDN
Hi experts, I am encountering following error when running a sample webdynpor application from SE80. I have included details of my Hosts file entries and profile parameter in the details below. My SAP system is installed on my desktop computer as a s
-
Where is the window that displays midi chord names played on my controller??
I can't seem to locate the pane in the transport window that displays chords/notes played on the midi controller that was present in past versions. Any ideas, please????
-
Wifi dropping issues on mac os x lion
I have a mac my wifi work fine and so as my other computers and iphones and so on. But as soon as i upgraded to to mac os x lion my wifi started to drop and lose wifi range no i can only use wifi close to my dsl which is sensless but thats the only
-
The Music Library on my iMac is mostly in Apple lossless format. I want to make an MP3 CD of many of these songs. Apples' iTunes apparently can't do this on the fly when I want to burn the playlist. Are there some options deeper in the various menus
-
Web Application Designer - Display One characteristic from a Query
Hello, I have a query in WAD and am wondering if you can map one field from that query to a web item. I tried using the info field item but that only seems to work for filters and query information (title etc.). There are many fields in the query a