Add a blank line in the string

I get a few sterning DB, I want to do if a new / line n is find add and empty string line, how to handle this?

Do you mean?

line = line.replaceAll("\n", "\n\n");

Tags: Java

Similar Questions

  • SQL add a blank line will cause

    Hello

    Currently, I use a temporary table to add a blank line to the top / the beginning of my results of the query. I'm moving to stored procedures in MS SQL and wanted to know if it is possible to add a blank line directly in my SQL, so I can remove the solution in the temporary table.

    Any thoughts on this is appreciated!

    cfwild

    Hello

    Thanks for the idea. It worked perfectly! For those seeking just a line insert empty 'above' the results of the query, here was the final code:

    SELECT the category
    SYNDICATION
    UNION
    SELECT "
    ORDER BY category

    Once again, thank you for the help!

  • Avoid blank lines at the top of the column

    So I create posts of all the two weeks and I had a question that would make my job easer.

    I've been messing around with the widow and orphans, but I have a slightly different problem.

    We use returns between paragraphs (a blank line between paragraphs), and I was wondering if there was a way to use GREP or showing something to automatically prevent blank lines at the top of a column.

    Right now, I have remove and re-add returns throughout the editing process, which as you can guess, can become messy and easy to miss.

    I wish I had where I don't have to do it all on my own, so the empty lines would be 'hide' automatically if at the top of a column, but would return if things get moved around.

    Thoughts?

    Thanks for the help.

    kwilly_1572 wrote:

    We use returns between paragraphs.

    .. can get messy and easy to miss.

    It's a reason that should not do this way. Correctly using the space before and/or after the space solves your problem.

  • Insert a blank line in the result set

    Hi friends,

    SELECT * FROM EMPLOYEES ORDER BY DEPARTMENT_ID;

    As a result of the foregoing, I need to INSERT a blank line in the result for each department_id. for example, the result should resemble the following:

    EMP_ID - NAME - SALARY - DEPARTMENT_ID
    101 - Albert - 10 000 - 10
    102 - Benjamin - 8 000 - 10

    103 - Chitra - 10 500 - 20
    104 - David - 4 500-20
    105 - Elango - 6 000 - 20

    106 - faye - 6 000 - 30
    107 - Ganga - 9 000 - 30

    etc.

    I don't want to insert into the table. I need a blank line just on the screen.

    Thanks in advance.

    Published by: James on March 8, 2010 11:37

    Something like this->

    satyaki>
    satyaki>select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>select m.empno,
      2         m.ename,
      3         m.sal,
      4         case
      5           when sal is null
      6           and  empno is null
      7           and  ename is null then
      8             null
      9         else
     10           m.deptno
     11         end deptno
     12  from (
     13        select k.empno,
     14              k.ename,
     15              k.sal,
     16              k.deptno
     17        from (
     18                select empno,
     19                             ename,
     20                             sal,
     21                             deptno
     22                from emp
     23            ) k
     24        union all
     25        select t.*
     26        from (
     27                select distinct null empno, null ename, null sal, deptno
     28                from emp
     29            ) t
     30        order by 4
     31      ) m;
    
         EMPNO ENAME             SAL     DEPTNO
    ---------- ---------- ---------- ----------
          7782 CLARK            2450         10
          7839 KING             5000         10
          7934 MILLER           1300         10
    
          7566 JONES            2975         20
          7369 SMITH             800         20
    
          7902 FORD             3000         20
          7876 ADAMS            1100         20
          7788 SCOTT            3000         20
    
         EMPNO ENAME             SAL     DEPTNO
    ---------- ---------- ---------- ----------
          7900 JAMES             950         30
          7499 ALLEN            1600         30
          7844 TURNER           1500         30
          7654 MARTIN           1250         30
          7521 WARD             1250         30
          7698 BLAKE            2850         30
    
    17 rows selected.
    
    Elapsed: 00:00:00.03
    satyaki>
    satyaki>
    

    Kind regards.

    LOULOU.

  • How to add an imaginary line in the result of the value of a SELECT statement.

    Hello all-

    I have requirment to add an imaginary line in the result set of a SELECT statement.

    For example lets say it is a pay table having the following columns:

    Number of Payment_id
    status varchar2 (10)
    number amount
    date of payment_date

    so here's the data: -.

    Payment_id status amount payment_date
    applied 1 100 12/07/2008
    2 Reversed 200 01 / 06/2009
    Applied 3 300 01 / 07/2009


    Here is my SQL

    Select * form payment where payment_date > = 01/01/2009

    The output will be

    2 Reversed 200 01 / 06/2009
    Applied 3 300 01 / 07/2009

    My desired output is less than

    2 Reversed 200 01 / 06/2009
    Applied 3 300 01 / 07/2009
    reversed-200 2, 01 / 06/2009-(Dummy Row)

    Third line here is the imaginary line that I add when the status is "reversed".

    I would be very grateful for any help on this...

    Thank you
    Gerard

    Cartesion join against a shadow table is a useful method to create a fictitious line:

    with my_tab as (select 1 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
                    select 1 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 1 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/05/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 4 Payment_id, 'Reversed' Status, -400 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 5 Payment_id, 'Applied' Status, 500 Amount, to_date('01/07/2009', 'mm/dd/yyyy') payment_date from dual),
                    --- end of mimicking your table
          dummy as (select 'Reversed' col1, 1 rn from dual union all
                    select 'Reversed' col1, 2 rn from dual)
    select mt.cust_id,
           mt.payment_id,
           mt.status,
           decode(dummy.rn, 2, -1*mt.amount, mt.amount) amount,
           mt.payment_date
    from   my_tab mt,
           dummy
    where  mt.status = dummy.col1 (+)
    order by mt.cust_id, mt.payment_id, dummy.rn nulls first;
    
    CUST_ID     PAYMENT_ID     STATUS     AMOUNT     PAYMENT_DATE
    1     1     Applied     100     07/12/2008
    1     2     Reversed     200     06/01/2009
    1     2     Reversed     -200     06/01/2009
    1     3     Applied     300     06/01/2009
    2     1     Applied     100     07/12/2008
    2     2     Reversed     200     05/01/2009
    2     2     Reversed     -200     05/01/2009
    2     3     Applied     300     06/01/2009
    2     4     Reversed     -400     06/01/2009
    2     4     Reversed     400     06/01/2009
    2     5     Applied     500     07/01/2009
    

    Published by: Boneist on January 7, 2009 23:10
    NB. You may need to mess around with the order if that is not in the order you want. You did not mention what the rules were for all orders expected, so I composed my own * {;-)

    Also, I added a (cust_id) identifier to differentiate different types of payments, as is usually the case. Remove unless it is not applicable to your case.

  • Add a blank line, while Double spacing turned on

    Sometimes, I want to add an additional line to a double spaced document. Is it possible to do so and to map it to a keyboard shortcut, so I don't have to go back a single space and double?

    This can be done via a text selection and new paragraph styles, a unique space and a double-spaced, with appropriate function key assignment. For each of these settings, you can a leading of 120% (1,2) simple and 240% (2.4) for line spacing. I suggest using accurate rather than single or double choices and then plug the values representing the spacing that appears just for your writing style and the main objective.

    Pages explicitly what version do you use, because the interface is different between the Pages ' 09 v4.3 and v5.6.1 on El Capitan?

  • Word RTF Tem [plate - insert a blank line in the loop

    I'm entering my template like this XML data (this is just an example of dumbed down):

    <? XML version = "1.0"? >

    < LABEL_TEST >

    < LIST_G_TEST >

    < G_LABEL_HEADER >

    < NAME > Parent 1 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Kid 1 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Parent 2 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Parent 3 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > 4 Parent < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Kid 4 < / NAME >

    < / G_LABEL_HEADER >

    < / LIST_G_TEST >

    < / LABEL_TEST >

    In summary, I have a list of Parents, and if they have a child, the name of their children is below. Not all parents have children.

    If the data is a bit like this:

    Name of the parent

    Name of the child

    Name of the parent

    Name of the parent

    Name of the parent

    Name of the child

    When I loop data in my RTF model, I want to be able to insert a blank line before all of the lines 'Parent '. A bit like this:

    Name of the parent

    Name of the child

    Name of the parent

    Name of the parent

    Name of the parent

    Name of the child

    I tried to do this by adding an empty xml tag in the list, like this:

    <? XML version = "1.0"? >

    < LABEL_TEST >

    < LIST_G_TEST >

    < G_LABEL_HEADER >

    < NAME > Parent 1 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Kid 1 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Parent 2 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Parent 3 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > 4 Parent < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Kid 4 < / NAME >

    < / G_LABEL_HEADER >

    < / LIST_G_TEST >

    < / LABEL_TEST >

    But that doesn't seem to work.

    Manny

    I found a solution that works very well.

    I added a new XML field to my data called .  In my model, this field is inserted in the line, but in a location where there is no data being printed. And it is formatted as white text, so that it basically just does not appear.

    So essentially, it's what I have now:

    Parent 1

    .

    Child 1

    .

    .

    Parent 2

    .

    .

    Parent 3

    .

    .

    Mother 4

    .

    Child 4

    .

    If the data is a bit like this:

    The name of the parent.

    The name of the child.

    .

    The name of the parent.

    .

    The name of the parent.

    .

    The name of the parent.

    The name of the child.

    When I loop data in my RTF model, the '. ' is a white text, then I get this:

    Name of the parent

    Name of the child

    Name of the parent

    Name of the parent

    Name of the parent

    Name of the child

  • How to add a new line in the JavaScript editor?

    I have a script like this:

    var n = this.getField("score").value;

    If (n > = 0 & & n < 5) {}

    Event.Value = "The WP 100% Bond\nThe 10% Stock WP / 90% Bond\nThe WP 20% Stock / 80% Bond."

    }

    I want out of this line as...

    The leap from 100% WP

    The Stock of 10% WP or the Bond of 90%

    The Stock of 20% of WP or 80%

    But it's not to honor the \n for a newline. How in the heck can you add a new line? I tried \r, \r\n, \n\n. It is to add a space character and looks like this...

    The leap from 100% WP WP 10% Stock or the Bond of 90% 20% of WP Stock or Bond of 80%

    You can use \n like you did to indicate a new row or \r (carriage return). If this does not work, be sure to set the Multiline field on the Options tab of the field properties dialog box.

  • Insert a blank line in the query output

    Is it possible to insert a blank line between two rows of the query output?

    In the EMP table, the column LINES is as follows:

    LINES
    1
    2
    3
    4
    1
    2
    3
    1
    2
    3
    4
    5

    I want to insert a blank line after every 1

    Please suggest.

    Sanjay

    I'm quite puzzled why you need rows in the dataset returned by a select statement that is empty.
    If you are using Oracle reports to the release date, you define the presentation of the report to have spaces between the rows returned by the select and have do not need to have the select statement returns a blank line after each line of data. If the output should be obtained by using another client, I think that the customer will have facilities for output formatting.

    Admit that you really need "blank lines" between data lines, I see only one way: use a temporary table and do an insert into select temporary_table (...) ... from... where... Then, in this temporary table, you can insert 'empty rows', which is actually not really empty, because they must have some fields that give the order of the rows. And then select in temporary_table, you place your order by the columns that are used to give the order for the release.
    Thus

    insert into temporary_table (
    ....
    )
    select ...
    from ...
    where ...
    ;
    for r in (
    select col1, col2, col3  -- columns used for order by
    from temporary_table
    order by col1, col2, col3
    )
    loop
      insert into temporary_table (col1, col2,col3, col4)
      values (r.col1,r.col2,r.col3, null);
    end loop;
    -- this way, a select * from temporary_tabel order by col1, col2, col3, col4 will return a blank row after each data row
    
  • Have blank lines on the page open automatically

    Hello

    Is it possible to have empty lines when the page is rendered as a table? It is a wizard that is generated in a table.

    Thank you
    Mary

    Create a process
    Choose the type of data handling processes
    Select Add lines slot table form
    Select on the laundry front header
    Enter the number of lines to add

    Kind regards
    Shijesh

  • How to add a new line at the top of manual tabular form

    I have a manual tabular form. I am trying to add a line at the top of the form, instead of the new line of being displayed at the bottom. any ideas are appreciated.

    Thank you
    Surya

    If you did a manual tabular presentation using a select statement as follows:
    Choose option...


    Union of all the
    Select... of double

    Try to simply reverse the two select:
    Select... of double
    Union of all the
    Choose option...

    I did this in an application, and it works.
    (I've never tried with sorting...)
    Concerning
    Stefano Corradi

  • Possible to add a new line in the description?

    To get this:

    CrackBerry.com:

    The Site #1 for users of BlackBerry & Abusers!

    in other words the above appears on two lines in the screen of the properties of the application, I simply added spaces like this:

    CrackBerry.com: The Site #1 for users of BlackBerry & Abusers!

    for the description of the application.  I prefer to be able to simply specify a new line character.  Is this possible?

    Patrick

    No, this is not supported.

  • How to integrate a mp.3 background without having a blank line above the header?

    Hello

    , I have integrated a Mp3 file that plays very well when loading the home page, however he created this white line above the header of the home page.  You can see it at http://rotorooterhsv.com

    I've embedded the file under page properties / metadata / HTML for < head >: < embed src = "music/Roto - RooterJingleFemaleSinger.mp3" autostart = "true" loop = "false" hidden = "true" > < / embed >. (The header also contains GA and a few other scripts)

    Thanks in advance for any advice!

    rotorooter screen capture.PNG

    HTML code foris not where you need to insert. As the audio player is already hidden, try to place somewhere in the page by using the object-> the option Insert HTML code. And using layers, you can place it in the back.

    Please see the following article on what labels can be added to the head section - http://www.w3schools.com/html/html_head.asp.

    Thank you

    Vinayak

  • Add blank lines to the report

    I create a report that lists a training topic and current employees who must complete the course. I would like to add a number any white lines (part of the page) to the bottom of the report to accommodate non-registered participants. This report will be printed, signed and then used as input to record the training.

    I know I can do a UNION at the bottom of the report, but I would like to than the number of lines to set using a hard rather than coded page element. Someone at - it an idea?

    I tried
    ...
     union
    select NULL, NULL, NULL, NULL, NULL
      from EMPLOYEES
     where rownum <= :P1727_BLANKS
    but this gives me a line no matter what.
    ...
    union all
    select null, null, null, null, null
    from dual
    connect by rownum <= :P1727_BLANKS
    
  • My indicator shows only the first line of the string

    Hi all

    I'm having some trouble with chains, could you help me?

    I use a device connected to my computer in a RS-232 port.

    I configured the VISA series correctly. When I write a command to my device, the answer is something like this:

    "XXXXX."

    YYYYYY

    2222

    44444

    WWWW.

    The problem is when I try to read this response. The channel indicator shows only one line at a time every single loop. And the other orders received are stored in the buffer until their time to be displayed to come. I mean:

    In the first loop device XXXXX responses.

    In the second loop the device responds YYYYYY but now I stored what must appear:

    2222

    44444

    WWWW

    XXXXX

    YYYYYY

    2222

    44444

    WWWW

    In the third loop, the device responds 2222 and stores again:

    44444

    WWWW

    XXXXX

    YYYYYY

    2222

    44444

    WWWW

    XXXXX

    YYYYYY

    2222

    44444

    WWWW

    How can I configure my blocks to display the full string?

    Thank you

    Murilo

    Post your code and we can better understand what is happening.

    My first is however you spend only the corrent, reading of the indicator.

    You use a chain shift reg with a knot to concatenate a String?

    Your zip code and we'll have a glance.

Maybe you are looking for

  • Cannot start from the CD on Satellite L10

    Hi, I had several problems during the last two weeks with my Toshiba laptop. I decided to back up all my files and use the recovery disk to erase everything. I put in the disc and then changed the BIOS so that the CD/DVD drive was the first. (I hope,

  • How to make the gyroscope and accelerometer in Mulitsim?

    I do a circuit with a gyrocope and an accelerometer in Mulitsim but cannot find these parts in the library. Is is possible to simulate these parts in Mulitsim? Waleed

  • HP PAVILION ELITE M9517C DESKT: NVIDIA NFORCE 10/100 Mbps Ethernet drivers upgrade

    I do a clean install for upgrade with Win 7 Pro 64-bit OEM. I ran the Win 7 Upgrade Advisor and need guidance on these issues, on what I need to do to upgrade: NVIDIA NFORCE 10/100 Mbps ethernetNVIDIA GeForce GT630NVIDIA High Definition AudioNVIDIA n

  • BlackBerry Q10 Q10 security wipe 15 + hours

    After downloading the latest OS update two weeks ago (too much air) my phone went to work almost perfectly, to have battery and severe lag problems drain (as in 3 hours that the battery would drain complete with NO use - even though I disabled all th

  • How to enter additional characters in a phone number

    I just upgraded to a 2 (Verizon) pre webOS 2.0.1 running, and I like it so far.  One thing I didn't understand how is implemented of contacts for issues of bridge with the passwords.  An example is a 10-digit number followed by followed by pause for