Converting strings with line feeds to a single line with identifying chars

Hi, I dont want to re invent the wheel if there is something out there that does this already. I want to take some string with multiple
line feeds and convert it to a single line. For example:
"I want this string
to be changed to
a single line"
to this...
"I want this string\r\n to be changed tor\\n a single line"

vsekvsek wrote:
OK, Hope this will make better sense. So right now a I have a routine that loads files like below:
"TEST\r\n TEST1\R\n TEST2"It's not clear to me at this point what you mean by that string.
After the initial word TEST, does that string have a backslash character followed by an r followed by another backslash followed by an n? Or does it have a carriage return followed by a line feed. (\r followed by \n)
We format it when loading in a way that it will look like this when queriing from the DB
"TEST
TEST1
TEST2"It doesn't look like anything "when querying from the DB." That part doesn't make any sense.
Either the string has a backslash followed by an r, in which case when you render in in a text editor or on a console it will look like a single line with a visible backslash character followed by an r, or it has a carriage return (\r) in which case it will look like multiple lines when rendered in a text editor or on a console.
Later I re-extract it to a file from the DB and What confuses me is when I inspect the string it looks like this
"TEST\r\n TEST1\R\n TEST2"How are you inspecting it? If it's in a debugger or similar tool, it's not uncommon for it to be showing a carriage return character (\r) as a visible backslash followed by an r, rather than interpreting it and rendering a new line. This is so that you can see exactly what characters are in there, rather than wondering about the specific whitespace.
>
but it extracts to my file like
"TEST
TEST1
TEST2"
So I guess there are some hidden cr's or something messing it up that I need to manipulate but not sure how to apprach it?I still don't know what you're trying to do, or if you even have an actual problem with your data or are simply not understanding what you're seeing.

Similar Messages

  • Measuring of Text with Multiple Fonts in One Single Line

    I am following a request to write C++ code for a label that contains several text elements in one single line, varying by font, size, color.... Ok, that can be done easily in GDI+ by measuring each element's width and then execute a DrawString
    for each of the text elements starting at its calculated position.
    So far, I failed miserably.
    The horizontal text positions did not appear to be correct. I reverted now to very simple text width measuring tests where the results are still puzzling.
    Test 1 (GDI+): Use of MeasureString
    With the same font, the width of the string "MM" does not match the double with of the string "M". This cannot be explained with eventual rounding problems.
    Test 2 (GDI+): Use of MeasureCharacterRanges
    Used the same font as for the first test. The width of "MM" is now exactly double of the width of "M". But: The width of the "M" ist lightyears away from the measurement result in the first test.
    Test 3 (GDI): Use of GetCharABCWidthsFloat
    Attempted to create a GDI font as close as possible to the GDI+ font in the previous tests. Unfortunately, this third test shows results which do not match the previous results at all.
    I am appending the full example here; the results I found during the debug session have been added as comments:
    void ApplWindow_TextDrawTest(HDC hDC)
    Gdiplus::Graphics *G = new Gdiplus::Graphics(hDC);
    G->SetTextRenderingHint(TextRenderingHint::TextRenderingHintClearTypeGridFit);
    Gdiplus::StringFormat MyFormat;
    MyFormat.SetAlignment(Gdiplus::StringAlignment::StringAlignmentNear);
    MyFormat.SetFormatFlags(Gdiplus::StringFormatFlags::StringFormatFlagsNoWrap);
    Gdiplus::Font TextFont(L"Calibri", 36, Gdiplus::FontStyle::FontStyleBold, Gdiplus::Unit::UnitPixel);
    const wchar_t *Text1M = L"M";
    Gdiplus::PointF TextOrigin1M(0, 0);
    Gdiplus::RectF TextBounds1M;
    const wchar_t *Text2M = L"MM";
    Gdiplus::PointF TextOrigin2M(0, 50);
    Gdiplus::RectF TextBounds2M;
    //--- Test #1: using MeasureString ----------
    G->MeasureString(Text1M, (INT)wcslen(Text1M), &TextFont, TextOrigin1M, &MyFormat, &TextBounds1M);
    G->MeasureString(Text2M, (INT)wcslen(Text2M), &TextFont, TextOrigin2M, &MyFormat, &TextBounds2M);
    //--- Results: Text 1 Width= 44.414 ("M")
    //--- Text 2 Width= 76.828 ("MM")
    //--- Test #2: using MeasureCharacterRanges ----------
    Gdiplus::Status RCode;
    Gdiplus::RectF LayoutRect(0, 0, 1000, 100);
    Gdiplus::Region RegionsList[3];
    Gdiplus::CharacterRange CRanges[3];
    CRanges[0].First = 0; CRanges[0].Length = 1;
    CRanges[1].First = 1; CRanges[1].Length = 1;
    CRanges[2].First = 0; CRanges[2].Length = 2;
    MyFormat.SetMeasurableCharacterRanges(3, CRanges);
    G->MeasureCharacterRanges(Text2M, (INT)wcslen(Text2M), &TextFont, LayoutRect, &MyFormat, 3, RegionsList);
    RCode = RegionsList[0].GetBounds(&TextBounds1M, G); // Result: Text 1 Width = 32.000 ("M")
    RCode = RegionsList[1].GetBounds(&TextBounds1M, G); // Result: Text 1 Width = 32.000 ("M"; the second char)
    RCode = RegionsList[2].GetBounds(&TextBounds2M, G); // Result: Text 2 Width = 64.000 ("MM")
    //--- Test #3: using the good old GDI ----------
    int MapModeResult = SetMapMode(hDC, MM_TEXT); // MM_TEXT is equivalent to Unit::UnitPixel?
    HFONT TextFont3 = CreateFont(36, 0, 0, 0, FW_BOLD, false, false, false, ANSI_CHARSET, OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, VARIABLE_PITCH | FF_DONTCARE, L"Calibri");
    HGDIOBJ PrevFont = SelectObject(hDC, TextFont3);
    ABCFLOAT ABCCharData;
    BOOL RFlg = GetCharABCWidthsFloat(hDC, (UINT)'M', (UINT)'M', &ABCCharData); // Results: abcfA = 2.000; abcfB = 22.000; abcfC = 2.000
    //--- End of Test ---
    delete G;
    Does anybody have an idea why I get so different results?
    Thanks in advance.

    This is a development question and should be directed to a forum that assists in coding. The forum you posted to is for Windows 7 related questions.
    Sorry I cannot help you
    Don't forget to mark the post that solved your issue as "Answered." By marking the Answer you are enabling users with similar issues to find what helped you. Lewis Renwick - IT Professional

  • Can the Terminal add a user(with all options) on a single line?

    Howdy All,
    Can the Mac Terminal add a user, with all options desired, on a single line?    If so, can I get an example of this single terminal line to work from?
    Thanks

    Thanks Drew!   You have some great thoughts there. Perhaps I should provide a clearer environment of each high school(4). All classrooms have a lock down Windows environment. (There are no Macs any where in any classrooms.) The mini-tower will be the only Mac on each high school campus. we're in Dell country. The desktops are locked in such a way that only the ghosted/installed software on each hard drive works and no other software can be installed. USB sticks can't run any exe, jar, or other executable file. Even the other drives on the network can't run them. This has been setup to prevent students from bringing games into the environment and running them. Only the single classroom in each high school, where Web Tech is taught, has a ftp tool installed. Students cannot bring and use their own laptops either. So there really isn't any stray ftp activity happening. You cannot "ftp" out of the network! And there is only the one Mac available per campus.  All this makes it certainly easier to maintain for sure. I am the only user in the school district they let run a personal laptop...mine has Ubuntu (tweaked).  My knowledge of Linux has led them to assign this project to me. They are MS based entirely and so is their knowledge base.
    I've got to teach the other 4 teachers how to manage the mini-tower.  Basically it is this:
         Start and stop Apache2,
         Start and stop vsftp,
         Add ftp users(students will only have directory:           /Library/Server/Web/Data/Sites/Default/studentlastname.firstname  )  Students will not log on to the min-   tower directly as any normal user would, but only through ftp. (I.E. no /home directory) ,
         Remove/delete students as needed
         (I'll pre-install cgi-bin scripts on these to keep it simpler on the other teachers and myself.)
    With this in mind, you can see why a basic script or single command line to install these students would be great! I want to keep it simple to avoid mistakes the teachers might make adding users. Once I understand adding a user (in a terminal) better on a Mac, I may write a script to make it happen for them.
    I'd also like to understand removing/deleting a student/user better to insure everything is gone when executed.
    I hope this clear things up. Any help is much appreciated.    THANKS!!!

  • Please help :- Line Feed at end of line

    Hi,
        When i uses this class  :- CLASS cl_abap_char_utilities DEFINITION LOAD. and this   constant :- CONSTANTS: c_cr_lf TYPE c VALUE cl_abap_char_utilities=>cr_lf. it will give me a line feed when i open my report in excel file but not in text file.
        The reason i uses the above is becoz i dont want the line to be truncated if its space at the end of the line. If i download my report into a txt file, i wont see the line feed but when i save the file as txt file and then open with excel, it will show me the line feed. How can i solve this where i can keep the space at the end of each line and not showing the line feed when i open with excel ? Anyone can help ??

    HI,
    sort gt_itab01 by MATKL.
    LOOP AT GT_ITAB01 INTO GS_ITAB01.
    AT END OF MATKL.
    SUM.
    MOVE-CORRESPONDING GS_ITAB01 TO GS_ITAB02.
    MOVE GS_ITAB01-MENGE TO GS_ITAB02-MENGE1.
    APPEND GS_ITAB02 TO GT_ITAB02.
    ENDAT.
    CLEAR GS_ITAB01.
    ENDLOOP.
    rgds,
    bharat.

  • Multiple lines of data to single line

    Hi All,
    Need help on getting data in single line out of multiple lines from bex query based on condition.
    Reporting using Crystal 2011 SP06
    Please find the attachment.
    Thanks
    Santhosh

    Hi Santosh,
    Here's what you need to do:
    1) Create a formula with this code:
    If {Confirmed_Qty} > 0 then {Conf_Delivery_Date}
    2) Go to Insert Summart > Choose the above formula field as the field to summarize > Choose 'Max' as the sum function > Under Summary Location chose Group section
    3) You would also need to insert a Max function on the Confirmed Qty field and place the summary on the Group Section like all the other summaries.
    -Abhilash

  • Many lines of codes into single line

    I want to execute t-sql-query from VB.NET program. I wrote and successfully executed sql query in MANAGMENT-STUDIO-EXPRESS..  But the problem is that. The codes are of 10 lines. And i need single line code to paste in vb.net.. How is that possible
    In qbasic i used to use COLON ":" to merge lines. 
    Is merging lines possible in SQL SERVER. If yes how?? Please help

    Hi,
    Like Rsingh, suggested create Stored Procedure - 
    http://support.microsoft.com/kb/309486
    To combine multi line code -
    http://msdn.microsoft.com/en-us/library/ba9sxbw4.aspx
    http://stackoverflow.com/questions/461714/vb-net-single-statement-across-multiple-lines
    http://blogs.msdn.com/b/bethmassi/archive/2007/10/23/avoid-underscores-in-your-multiline-strings.aspx
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

  • Multiple invoice line items posted as single line item in FI

    Dear Gurus,
    My client has a specific requirement.
    We are required to maintain a rebate condition at item level. In the invoice the values of rebate conditons are appearing as per the line item. This rebate condition has been maintained as statistical and accrual key has been assigend to it. Respective configuration has been done in VKOA. Accural check box has been activated for the rebate condition type.
    Now when we are posting the invoice to FI, client requires that instead of line item wise posting of accrual amount it should post entire accrual amount in the single line item. In other words it is like posting of header amount directly, without any line item wise splitting.
    Please help me ASAP.
    Thanks in advance.
    Regards
    Piyush Ranpura

    Dear Friends,
    I am thankful for your replies. But probably I was not able to put the issue is the proper manner. Let us consider this example -
    Mat. codes - M1, M2, M3 & M4   Rebate cond. - ABCD    Accrual key - ABC    GL - 12345678
    In the invoice, rebate values are determined as follows for the each line item -
    For Line item 10, Material M1
    ZSHA   -   100
    For Line item 20, Material M2
    ZSHA   -   125
    For Line item 30, Material M3
    ZSHA   -   100
    For Line item 40, Material M4
    ZSHA   -   75
    While the invoice is released for accounting follwing entries are there
    xx 1 xx
    xx 2 xx
    xx 3      100  12345678
    xx 4      125  12345678
    xx 5      100  12345678
    xx 6        75  12345678
    xx 7 xx
    xx 8 xx
    But my requirement is
    xx 1 xx
    xx 2 xx
    xx 3    400  12345678
    xx 4 xx
    xx 5 xx
    How it could be done?
    Thanks & Regards
    Piyush Ranpura
    Edited by: Piyush Ranpura on Sep 1, 2010 9:10 AM

  • Help me in Converting textarea msg to single line string

    Please help me in converting the textarea message with line breaks in to single line string. because i shud pass that to the Javascript which doesnot accept line breaks.
    <%
    StringBuffer text = new StringBuffer(request.getParameter("textarea1"));
    int loc = (new String(text)).indexOf('\n');
    while(loc > 0){
    text.replace(loc, loc+1, "<BR>");
    loc = (new String(text)).indexOf('\n');
    out.println(text);
    %>

    Hi,
    i did not understood your problem. javascript supports \n character processing. so you should not get any error. Do one thing write a javascript function, that replaces all \n with "". this will solve your problem
    funciton replaceNewLine(StringValue) {
    StringValue.replace('\n','') (check replace() syntax once)
    have fun!!
    raj

  • File adapter and line feeds

    Hi,
    we need to produce a flat file using the content conversion of the file adapter without any line feed (the target structure is a complex one with several record types).
    Example
    What we get now:
    *AAheaderA
    *ABheaderB
    *BAItem1
    *CAsubitem1
    *BAItem2
    What we need:
    AAheaderAABheaderBBAItem1CAsubitem1*BAItem2
    It seems that with NameA.endSeparator parameter you can only add a new character, but I need to delete the line feed.
    Is it possible with standard file adapter or do we need do create our own module with java?
    Thank you.

    Hi Stefano,
    So you Basically want to do content conversion at the receiver end and that is basically to get the entire data in one line.For that please go through these links below.It clearly explains your requirement.
    <a href="/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion Receiver with Content Conversion</a>
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm">Converting File Content in the Receiver Adapter</a>
    carefully make a note of the "The ‘endSeparator’ parameter.
    Regards,
    abhy

  • Utl_file.utl_raw adds a line feed at the end of the line. How to avoid it.

    utl_file.utl_raw adds a line feed at the end of the line. I have to send some binary files to my vendor and they do not want a line feed at the end of the line.
    When I execute the sample program below, it creates a file with a line feed(chr(10)) at the end of the line. When I do dump in hexa, it shows a character x0A
    How to avoid the line feed at end of line?
    We are using Oracle 9i on unix platform.
    declare
    l_output           utl_file.file_type;
    v_raw      raw(32767);
    v_trlr_rec_code      VARCHAR2(2);
    v_trlr_evnt_title      VARCHAR2(6);
    begin
    l_output := utl_file.fopen( 'RM_MHE_IN_DIR', 'abc.dat', 'w', 14 );
    v_trlr_rec_code      := '99';
    v_trlr_evnt_title      := 'STARTD';
    v_raw := HEXTORAW(v_trlr_rec_code) || utl_raw.cast_to_raw(v_trlr_evnt_title);
    utl_file.put_raw( l_output, v_raw );
    utl_file.fflush( l_output );
    utl_file.fclose( l_output );
    dbms_output.put_line( utl_raw.cast_to_varchar2( v_raw ) );
    EXCEPTION
    WHEN OTHERS THEN
         dbms_output.put_line( sqlerrm );
    end;
    /

    oops, sorry i overlooked the fact that the db is 9i; thanks for pointing it out Solomon.
    Not sure about this, but a workaround could be to remove the "\n" characters at the end of each line using one of the many Unix utilities after the file has been created.
    isotope

  • Does USD NACHA CCD Plus Format support one single payment with one vendor?

    Hi,
    We are implementing USD NACHA CCD Plus Format file for my customer.
    Have the following query:
    Does USD NACHA CCD Plus Format support one single payment with one vendor and another single payment with
    different vendor in single file or will it generate two files for two payments or will it support single payment only.
    Can anyone help us in this regard.
    Thanks,Venkat.

    I have created one invoice1 with one vendor and another invoice 2 with
    different vendor processed the PPR using USD NACHA CCD Plus Format .
    Both two payments came single file.
    But we know that USD NACHA CCD Plus Format support Single Payment only.
    Can anyone help us in this regard.
    Thanks,Venkat

  • Transaction ME9E - Printing Single Line Schedule Agreement

    We are trying to print a line item that has a different delivery address than that of the header.  This is a single line document and the address is different.  The problem we have is when the scheduling agreements has only one part number and the delivery address for the part number is different then the default company/plant address.  This process is predominant when you have subcontract process.  We are unable to print the address at the line level for a single line document but system does this correctly and prints this delivery address when there are two part numbers in scheduling agreement.  How can we get this to work for us for single item documents?  This is critical for our end user.  We need to have the system access the text element ITEM_DELADDRESS in the MAIN window and not produce the address in the HEADER_DELADDRESS element in the CONSGNEE window.

    Hello,
    There are two possible status for schedule lines:
            1- Fixed schedule lines : System doesn't change these schedule lines upon MRP run
            2 Non fixed schedule lines : during MRP run, system deletes these schedule lines and creates new ones.
    To make a schedule line fixed there are two possibilities:
                        1- User set manually the indicator fixed schedule line in transaction ME38
                        2- Schedule line lies within the firm period.
    The firm period :
    For each schedule agreement you can define the firm zone : 
    1- ME32L change schedule agreement
    2- select the item then in toolbar> Item> More function-->additional data  Scheduling control
    enter the firm zone "number of days".
    If schedule line lies whithin this zone system will kepp it and create new line for additional requirement
    Best Regards

  • Converting multiline text string to single line

    How do I convert a multiline text string into a single line text string

    Hi Bart,
    what's a multiline text string?
    1) You have an array of string: simply use "string concatenate" to convert from array to scalar string.
    2) Your string contains CR and/or NL characters: use "Search/Replace..." for this string, replace all EndOfLine chars by space (or which char you may prefer)...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to send string with line feed to Agilent 33250A via COM1

    Agilent 33250A is a function generator. In HPERTERMINAL, when "Send line ends with line feeds" is enabled, simple strings make it work well, such as: "APPLQU", "OUTPUT ON", etc...
    But I can't make it work with .vi file. COM setting is correct because 33250A shows "remote" icon immediatly after string sent. It will respon "error" to any mismatched setting (e.g. 9600 vs 115200). So, the connection is there but it just doesn't respond to commands.
    I don't know why. The termination character is enabled in .vi
    I apprecite your help to make the .vi to send string just like the HYPERTERMINAL with 'line feeds'.
    Thank you very much.
    Jian
    Attachments:
    Serial_Communication.vi ‏40 KB
    Write2COM1.vi ‏22 KB

    From what I can see it looks like you are NOT specifying what termination character you want to use when you call the serial port init.
    When not otherwise specified, the port will be configured to use the default termination character which is a "carrige return" HEX 0A.
    Try wiring a "Line Feed" constant to the init VI.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Replace line feed with perl

    I'm trying to replace 'line feed & space' with a line feed:
    perl -pi -e 's/\n /\n/g' ~/Desktop/scrap
    With no luck. Any help?

    I'm guessing this is related to line endings. If the file has legacy mac line endings it will behave as a single line. Try running the following. If it reports 0, then you'll need to convert the line endings:
    <pre style="border: 1px solid #ddd; padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 25ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #444; background: #eee; line-height: normal">wc -l < ~/Desktop/scrap</pre>
    The following will convert old mac line endings (as well as windows) to unix:
    <pre style="border: 1px solid #ddd; padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 40ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #444; background: #eee; line-height: normal">perl -pi -e 's/\r\n?/\n/g' ~/Desktop/scrap</pre>

Maybe you are looking for

  • Asking specific client certificate (not certificates trusted by authority)

    As I understand from what I read so far, during the handshake negotiation for two way ssl, the server sends the client a list of trusted certificate authorities and say to the client: "hey, those are the authorities I trust. send me a certificate tha

  • How to invoke a custom adapter from a BPEL process

    Hi guys, I've implemented a custom outbound adapter and deployed successfully on Weblogic V.10.3.4. My current installation also consists of Oracle SOA Suite 11g / JDeveloper 11g (11.1.1.4.0) In the Weblogic administrator's console, *1.* I navigated

  • Suddenly cannot open webpage file ending IDX

    I am very new to Apple. I have a MacBook Pro. There is a wesite I use ften and I have never had problems with it. Suddenly I get halfway through it and nothing happens when I submit. Nothing at all. As if I never pressed submit at all. Now this site

  • Error on T code PRRW

    Dear all, While running Tcode PRRW we got error  'Tax code in procedure TAXCY is invalid Trip could not be included in posting run'. Please help me to let out this problem. Regards, Pramitha.

  • Openitem clearing

    hi everyone, i have a one issue . please clear this. i have openitems in vender account but when clearing this its not showing in openitems list (f-44).any one can know this resoans please give me replay.but i did not block payment for vender. Advanc