Replacing multiple new line characters
how to replace multiple new line characters in a line.
Suppose for example my line contains Example1#####Example2##Example3###Example4,
then the output should be Example1#Example2#Example3#Example4.
Hi Sid,
You Can try this code
DATA: ld_string TYPE string,
ld_string1 TYPE string,
ld_string2 TYPE string,
ld_string3 TYPE string.
ld_string = 'Example1#####Example2##Example3###Example4'.
REPLACE ALL OCCURRENCES OF '######' in ld_string with '#'.
REPLACE ALL OCCURRENCES OF '####' in ld_string with '#'.
REPLACE ALL OCCURRENCES OF '###' in ld_string with '#'.
REPLACE ALL OCCURRENCES OF '##' in ld_string with '#'.
write:/1 ld_string.
Regards
Pavan
Similar Messages
-
Replacing windows new line characters with JAVA
I am importing a file into the database... the file is written by a client using windows, and it is a text file.
When there is a windows new line character at the end of the line (^M), it is getting saved to the database as part of the string value.
When we parse this data to run a report, the (^M) are being written back out to the file and causing the fields and data not to line up.
We want to REPLACE the ^M with some other character (whatever it doesn't matter)... how can java do that???
We tried replacing '/n' with '###' and it will show the ###, but the line still breaks.
TIA,
TonyaThe characters in question are cr = \r = ascii(13) and lf = \n = ascii(10). Windows uses CrLf, Unix uses Lf and some systems use just Cr. You can use the String.replaceAll or the pattern matching classes to fix this up, see java.util.regex.Pattern, and java.util.regex.Matcher.
-
Finding New Line characters in string
Hello.
I have a textstring in which there are New Line characters. These cause problems when inserting the data.
An example is as follows (assume a table test exists with one column col1 VARCHAR2(2000):
CREATE TABLE test (col1 VARCHAR2(2000));
INSERT INTO test (col1) VALUES ('first line
second line');
INSERT INTO test (col1) VALUES ('first line' ||
chr(10) ||
'second line');
The first INSERT will fail but the second will succeed.
I want to find and replace these characters programatically in PL/SQL.
How can I edit a textstring in PL/SQL and replace the new line characters with ||
chr10) ||?
/LarsHow about this:
declare
v_oldstring VARCHAR2(50) := 'Line1'||chr(10)||'Line2'||chr(10)||'Line3';
v_tmpstring VARCHAR2(50);
v_newstring VARCHAR2(50);
begin
dbms_output.put_line(v_oldstring);
select replace(v_oldstring, chr(10), '''||chr(10)||''')
into v_tmpstring
from dual;
v_newstring := ''''|| v_tmpstring || '''';
dbms_output.put_line(v_newstring);
end; -
How to write this logic in EL expression ? (new line characters in string
iam using JSTL EL expression in my JSP.
iam printing a string in JSP as ${vobject.rmessage} where rmessage is a string .
problem is i want to identify the newline characters in the above rmessage string and print the line break <br> in html where ever the new lines character is present in the string.
How should i write an EL expression for the above.
Can anyone please guide me on writing EL expression for the above problem?Several ways. You can wrap the output with <pre> tags. You can apply CSS property white-space: pre; to the element. You can use String#replaceAll() in the Java code to replace each occurence of "\r\n" by "<br>".
-
How do I detect new line and carriage return characters with
string functions like replace? It works if I actually insert a new
line in the function by pressing return, but that messes up the
formatting and makes reading the code less intuitive.You may need to look for both chr(10) and chr(13) depending
on O/S. On *NIX you're likely to need to check for both. -
Finding nr of "new-line"-characters in string
Hi!
I looking for a smooth way of achieveing the number of "\n" characters in a string.
e.g.
String tmp = "There is a house\n in New Orleans, \n they call the Rising Sun\n";
This string should return number 3 (three occurrences of the '\n' character.
How ?
/RickardI'm not sure if this is the best way to do this but it works ok,
String tmp = "There is a house\n in New Orleans, \n they call the Rising Sun\n";
java.util.StringTokenizer st = new java.util.StringTokenizer(tmp, System.getProperty("line.separator"));
int counter = 0;
while(st.hasMoreTokens()) {
st.nextToken();
counter++;
} -
How to retain new line characters when using Node.getNodeValue()
Hi,
I have xml as shown bellow
*<DETAILS>*
this is line one
this is line two
thi is line three
*</DETAILS>*
when I parse this using dom( Node.getNodeValue() ), the value I am getting is as shown bellow
this is line onethis is line twothis is line three
but I wanted as is I have in my xml i.e,
this is line one
this is line two
this is line three
( to show that as is in HTML page)
can some body help me ??
Thanks in advance .Hi,
You could try this:
replace(your_data, chr(10), '') -
Change salesorder - add multiple new lines
All
I have following problem:
Based on a flatfile I have to add several scheduled line items to an existing sales order. I found the BAPI BAPI_SALESORDER_CHANGE but I am not able to add multiple items. It works with 1 item but with 2 of more the quantity fields are not filled in .
I think I have to fill in the item numbers, but these are unknow because of a BOM of material in certain cases.
Thanks for a quick response
JHi,
refer this code
REPORT Y730_BDC5 .
*HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(100) TYPE C,
END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
LIFNR(10) TYPE C,
BUKRS(4) TYPE C,
EKORG(4) TYPE C,
KTOKK(4) TYPE C,
NAME1(30) TYPE C,
SORTL(10) TYPE C,
LAND1(3) TYPE C,
SPRAS(2) TYPE C,
AKONT(6) TYPE C,
FDGRV(2) TYPE C,
WAERS(3) TYPE C,
END OF IT_XK01,
BEGIN OF IT_BANK OCCURS 0,
BANKS(3) TYPE C,
BANKL(10) TYPE C,
BANKN(10) TYPE C,
KOINH(30) TYPE C,
LIFNR(10) TYPE C,
END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'C:\VENDOR.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DUMMY.
LOOP AT IT_DUMMY.
IF IT_DUMMY-DUMMY+0(2) = '11'.
IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
APPEND IT_XK01.
ELSE.
IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
APPEND IT_BANK.
ENDIF.
ENDLOOP.
LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-REF_LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
IT_XK01-LIFNR.
perform bdc_field using 'RF02K-BUKRS'
IT_XK01-BUKRS.
perform bdc_field using 'RF02K-EKORG'
IT_XK01-EKORG.
perform bdc_field using 'RF02K-KTOKK'
IT_XK01-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELX1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
IT_XK01-NAME1.
perform bdc_field using 'LFA1-SORTL'
IT_XK01-SORTL.
perform bdc_field using 'LFA1-LAND1'
IT_XK01-LAND1.
perform bdc_field using 'LFA1-SPRAS'
IT_XK01-SPRAS.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-KOINH(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
DATA : FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKS.
CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKL.
CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKN.
CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-KOINH.
IDX = IDX + 1.
ENDLOOP.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
IT_XK01-AKONT.
perform bdc_field using 'LFB1-FDGRV'
IT_XK01-FDGRV.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
IT_XK01-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM. -
The HTMLEditor kit inserts extra newline characters when there is a space in the line and the line is greater than 80 chars? Can anyone tell me how to get rid of these extra newlines or how to set an unlimited or hugh line length as would be seen in HTML?
Thanks in advance!!Hi
I've the same problem, does anyone get a solution to this?
Thanks for your help! -
Hi,
I would like to use the find/replace function in Flex Builder
to replace a text .e.g. Hello by this text followed by a newline
meta character \n. But I can't get it to work and it should be so
simple. Who can help me? Using \n does not work.
Thanks!It seems to be a bug in Eclipse. I can find a lot of
reference material to the bug. Alas, not a single piece of
information that shows me if the bug has already been
fixed......... -
Hi,
One of the fields is the flex field. In the xml it is like below -
<SORT_FIELD1_INV>110
000
000
110000
0000
0000</SORT_FIELD1_INV>
I want to replace this new line in between with '.' and the output in excel should be
000.000.110000.0000.0000
I tried using the <?xdofx:replace...
but could not get the result.
Thanks.Hi,
Solution is:
<?xdofx:replace(../../../../../../SORT_FIELD1_INV,chr(10),' ')?>
Note this only works for I think 10.1.3.3.1 or higher.
On 10.1.3.2.0 Build 87 you'll get:
Caused by: oracle.xdo.parser.v2.XPathException: Extension function error: Method not found 'chr'
Note I also tried the following which should work, but didn't do any translate!!
<xsl:value-of select='translate(../../../../../../SORT_FIELD1_INV," 	
"," ")'/>
Regards,
Gareth
Blog: http://garethroberts.blogspot.com/ -
Enter Text in Multi Line TextBox and New Lines
Hi Guys,
I have a form that takes a users input and saves to an access
database.
The data is in turn drawn by a recordset and displayed on an
ASP page using VBS.
The form that takes the info has 1 textbox thats multi line
and I want it to be a simple input box except when the user adds a
line break by hitting return I want this to be reflected when the
record is drawn to the detais page..
Just now no matter how many times I hit return key when
typing in the multi line text box and add paragraphs or simple
sentances they all come out with no line breaks on the page when
shown???
Do I have to make my own rich text box editor? or is there
something Im missing?
Thanks in advance for any thoughts.
TagTag2007 wrote:
> Thanks Im on the site now and dont see the lite
version?? Do you have a link to it please..
InterAKT was acquired by Adobe in September and most of its
products
were discontinued. The full version of KTML is now part of
the
Kollection suite.
The solution to your problem is very simple, though. I'm
sorry I can't
give you the exact coding, because I haven't used ASP for
many years.
However, all that you need to do is to create a function that
searches a
string for new line characters and replaces them with
<br> (or <br />
for XHTML).
PHP has a built-in function (nl2br()) to do this, but in ASP
you need to
search for the new line character code.
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
How to search for a new line character in sql
hi..i am using oracle 10g.
basically i am looking for usage of columns.I want to see which all columns are used in
joins.
this is the quey i have written.
but
if there a new line between WHERE ,AND those scenarios are ignored.how to take care of these new line characters?
SELECT DISTINCT s.TYPE, s.NAME, s.owner, table_name, column_name --,line,text
FROM all_source s, cols c, all_dependencies d
WHERE s.NAME = d.NAME
AND d.referenced_name = c.table_name
AND c.table_name = 'WSF_EDUCATION_ORGUNIT'
AND column_name ='ORGUNIT_TYPECODE_OID'
AND d.TYPE = s.TYPE
AND d.TYPE <> 'PACKAGE'
AND d.owner = s.owner ---FOR OVERLOADED OBJECTS
AND ( (UPPER (text) LIKE
'%' || 'AND' || '%' || column_name || ' ' || '=%'
OR (UPPER (text) LIKE
'%' || 'AND' || '%=' || ' ' || '%' || column_name
|| '%'
UNION ---if there is where
SELECT DISTINCT s.TYPE, s.NAME, s.owner, table_name,
column_name ----,line,text
FROM all_source s, cols c, all_dependencies d
WHERE s.NAME = d.NAME
AND d.referenced_name = c.table_name
AND c.table_name = 'WSF_EDUCATION_ORGUNIT'
AND column_name ='ORGUNIT_TYPECODE_OID'
AND d.TYPE = s.TYPE
AND d.TYPE <> 'PACKAGE'
AND d.owner = s.owner ---FOR OVERLOADED OBJECTS
AND ( (UPPER (text) LIKE
'%' || 'WHERE' || '%' || column_name || ' ' || '=%'
OR (UPPER (text) LIKE
'%' || 'WHERE' || '%=' || ' ' || '%' || column_name
|| '%'
)Hi,
Not sure if I get it, but you can look for characters using the ascii and chr functions.
You can change them using replace:
A new line:
SQL> select ascii('
2 ') from dual;
ASCII('')
10(Just press enter between the quotes)
Example how to replace it with a space:
SQL> with t as ( -- generating test string:
2 select 'this string has
3 a new line' str from dual
4 )
5 --
6 -- actual query:
7 --
8 select str
9 , replace(str, chr(10), chr(32))
10 from t;
STR REPLACE(STR,CHR(10),CHR(32
this string has this string has a new line
a new lineIf that isn't clear of when I'm missing the point then please post some narrowes down examples of what you get now and your desired output. Remember to put the tag around any code example you're posting. -
Handling new line character in XML
Hi,
Question : How can we specify new line character in xml ?
Explaination for use :
I have a xml structure like :
<?xml version="1.0" encoding="UTF-8"?>
<MT_ISO8583_XML_request>
<TRANSDETAILS>.
<TRANSACTIONAMOUNT>0000000000000000</TRANSACTIONAMOUNT>
<SYSAUDITNUMBER>225998394671</SYSAUDITNUMBER>
</TRANSDETAILS>
</MT_ISO8583_XML_request>
I am using Java mapping to convert xml to some satndard flat file format. It works fine for single message.
To handle multiple message i am using Multimapping split. Multimapping needs xml tags in traget structure also to split the message.
To achieve it without BPM, I want to take the whole content of my target file to one tag. When i do this i lost all the new line characters aslo. How can i preserve my new line character using XML ?
Regards
KulwinderAre you sure, that the nl characters are deleted?
They are usually not shown in the XML display.
You can also use an adapter module instead of a Java mapping. So you can do a split in mapping, but the conversion to the flat file in the adapter module. If you have already a Java mapping for this purpose, you can easily create an adapter module based on that Java code.
Regards
Stefan -
I have a formatted text which I store as a text node. By default the new line char's are converted into white spaces. I read elsewhere on this forum, that we should use the charecter entity reference equivalent &#A; for new line. I did not understand this idea clearly, so I tried this out:
In my formatted string, I replaced all instances of '\n' with '&#A;'. I create my text node as follows:
script.replaceAll("\n","&#A;");
scriptElement = document.createTextNode(script);
As expected when the XML is written the &#A10; is further encoded into "&#A10". And when I read back my XML from the parser, I get my string back with all the "&#A10;". I again need to do a replace all to get the new line charecters back.
My question is : Is there any other standard solution to this problem or the bottom line is to replace the new line and tabs with "MUMBOJUMBO" or a standard charecter entity ref and look for the same while reading back.
Is there anyway I could tell my XMLwriter to convert '\n' into "&#A;" and get back '\n' when I parse the XML?by default, all white spaces collapse: http://www.w3.org/TR/xsl/slice7.html#white-space-collapse
you can use xml:space="preserve" in your XML elements (tags) or
you can use <fo:block white-space-collapse="false" linefeed-treatment="preserve"> in XSL if you use XSL to format the XML.
Maybe you are looking for
-
Not printing Black ink at all!
Hi I'm in the UK and have recently in the past few months bought a new HP Deskjet 2540 All-In-One printer, I'm trying to print things out in black and white and it will not work! I have followed all troubleshooting tips including printing a Quality
-
Enable Attachment commenting in Reader using Acrobat Pro 8
I am using Acrobat Professional 8. My document consists of a main form that needs one form field filled and many pages stamped. There are also several attachments, each with form fields and/or the need for stamps. Once released, the document will res
-
Hi all, i have a report which uses a bapi to upload data . data is taken from a file on the pc. i have given the provision to provide the file path on the selection screen The report is running properly only problem is when running in the
-
Sending strings to a server..
public class sendToServer implements ActionListener { public static void main(String args[]) { new sendToServer(); public sendToServer() { JFrame mainFrame = new JFrame("Sending to server test.."); mainFrame.setSize(new Dimension(300,
-
Hi all, I am new to xmlp and i have experience only with the RTF Templates. Now my user wants the templates in PDF for some new reports. I dont know how to use PDF Templates. If any one had good experience with PDF Templates please give any forums or