New line in String

Hi,
how can I get a "new line" in a string?
\n
and
<br />
doesn`t work.
I tried it with a LANGUAGEINDEPENDENT_SHORT_NAME and a lot of different UI controls(StaticText, InputField etc).
Regards,
Andreas

Alle Mehrzeiligen Datentypen sind, so glaube ich jedenfalls, inkompatibel zu ABSL.
Webservice unterstützt z.B. Mehrzeiligkeit sofern ein enspr. Typ im BO dafür verwendet wird! z.B. Text
Um in ABSL Mehrzeiligkeit zu erhalten würde ich mit Ruby ein Dummy Feld mit einen "Return" füllen.
z.B. $controller.StringUtils.AsciiToChar(int) -> habe ich aber noch nicht getestet.
Danach könnten die Felder evtl über
this.multifield = "my 1. text" + this.dummy + "my 2. text";
gefüllt werden.
Gruß Kay

Similar Messages

  • How to remove new line from string

    I have a string say following
    String line = "one\ntwo\nthree";Now i am trying to remove new line from string. For this i did following
    String txt = line.replaceAll("\\n","");But i see still new line is occuring. Is it correct way. Please advice me.

    Ok. I was just using \n instead of \r\n. And i am in windows. I will give a try with \r\n
    Ok i tried using following , but it doesnt work.
    line = line.replaceAll("\\r\n","");Am i missing anything here. Please guide me.
    Edited by: ArpanaK on Oct 8, 2007 4:44 PM

  • Add a new line at the begining of a string in a Xquery ALSB3.0

    Has anyone figured out how to Add a new line at the begining of a string in a Xquery in ALSB3.0?
    Thanks for your Help.

    I believe this is related to BI Publisher. Any comments would be greatly appreciated.
    Thanks,
    Sinan

  • 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>".

  • JTextPane.setText(String) - New line problem

    Hello.
    I'm usin a JTextPane for a small editor I need.
    I'm using it for it's ability to use HTML format codes (<font color = #color>string</font> for a singular line);
    Now, It's loading lines from a text file. Then, I made a function to parse the array data into a singular string, and return it.
    It's along the lines of
    String parseArrayToString(String[] data) {
        String returnString = "";
        for(String s : data)
            returnString += s+"\n";
        return returnString;
    }This worked for JTextArea, but not for this.
    Is there any way to do this using JTextPane?

    More or less straight from from the number 2 google hit...
    package forums;
    // a slighty cleaned up version of:
    // http://www.java2s.com/Code/Java/Swing-JFC/JTextPanedemowithvariousformatandhtmlloadingandrenderering.htm
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.IOException;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextPane;
    import javax.swing.text.Document;
    import javax.swing.text.AttributeSet;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.SimpleAttributeSet;
    import javax.swing.text.StyleConstants;
    public class JTextPaneDemo extends JPanel
      private static final long serialVersionUID = 1L;
      private static final SimpleAttributeSet ITALIC_GRAY = new SimpleAttributeSet();
      private static final SimpleAttributeSet BOLD_BLACK = new SimpleAttributeSet();
      private static final SimpleAttributeSet BLACK = new SimpleAttributeSet();
      static {
        StyleConstants.setForeground(ITALIC_GRAY, Color.gray);
        StyleConstants.setItalic(ITALIC_GRAY, true);
        StyleConstants.setFontFamily(ITALIC_GRAY, "Helvetica");
        StyleConstants.setFontSize(ITALIC_GRAY, 14);
        StyleConstants.setForeground(BOLD_BLACK, Color.black);
        StyleConstants.setBold(BOLD_BLACK, true);
        StyleConstants.setFontFamily(BOLD_BLACK, "Helvetica");
        StyleConstants.setFontSize(BOLD_BLACK, 14);
        StyleConstants.setForeground(BLACK, Color.black);
        StyleConstants.setFontFamily(BLACK, "Helvetica");
        StyleConstants.setFontSize(BLACK, 14);
      private JTextPane textPane = new JTextPane();
      public JTextPaneDemo() {
        textPane.setPreferredSize(new java.awt.Dimension(640, 480));
        JScrollPane scrollPane = new JScrollPane(textPane);
        add(scrollPane, BorderLayout.CENTER);
        appendText("\nHere's", BLACK);
        appendText(" Duke Baby", BOLD_BLACK);
        appendText("!\n\n", BLACK);
        textPane.insertIcon(new ImageIcon("C:/Java/home/src/crap/Java2D/images/duke.gif"));
        appendText("\n\nIsn't he just so cute ;-)\n\n", ITALIC_GRAY);
        JButton btnLoad = new JButton("Load web-page: The Java Tutorials");
        btnLoad.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              textPane.setEditable(false);
              try {
                textPane.setPage("http://java.sun.com/docs/books/tutorial/");
              } catch (IOException e) {
                e.printStackTrace();
        textPane.insertComponent(btnLoad);
        setVisible(true);
      private void appendText(String text, AttributeSet attributes) {
        try {
          Document doc = textPane.getDocument();
          doc.insertString(doc.getLength(), text, attributes);
        } catch (BadLocationException e) {
          e.printStackTrace();
      private static void createAndShowGUI() {
        JFrame frame = new JFrame("JTextPane Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new JTextPaneDemo());
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            createAndShowGUI();
    }Cheers. Keith.

  • Adding New Line character to String

    Hi,
    I want to add a new line while concatenating strings.
    I am getting some string objects and put them together. while concatenating them i want new string to be displayed in new line.
    The purpose of this is i am displaying this bunch of strings on a mouse over finction using javascript. Hence i want the different values to be displayed on a new line.
    Any help is appreciated.

    You normally use \r\n or System.getProperty("line.separator") to get a newline in Java.
    But since you're talking about Javascript, the whole question makes really no sense here at a Java forum. Don't you just mean a linebreak in HTML? If so, it is just
    . If not, please elaborate or look for a Javascript forum. There are ones at webdeveloper.com and dynamicdrive.com.

  • Exporting string to csv keeping commas and new lines

    Hi there,
    I am exporting string to csv and have been removeing new lines and commas like so
    thing.toString().replace(/\n/g, '').replace(',','') ;
    how can I do this iwthout losing the line breaks and commas? I can't have them in atm because messes up the csv.

    JSON is for 'transfering' information that can be reassembled into number, string, array, object, etc. format afterwards.
    Excel can import CSV but it might not understand the complexity of the information. Tyically what you would do is serialize complex information with JSON, recieve it on the other side (wherever that might be) and then deserialize it. After you deserialize it using JSONs abilities to turn your information back into what is was (numbers, strings, arrays and object) it is up to you how you restructure the data for the format you choose.
    Your original intent of preserving CSV is best for Excel or OpenOffice Calc. You didn't mention your intent. JSON would package those (CRLF) \n's for you.

  • Replacing New Line character in a hexadecimal string in ECC5.0

    Hi,
    I am trying to create an XML document using ABAP.
    I have created one DOM and later used the DOM to get the XML content into an internal table in form of Hexadecimal String. In that internal table(which contains XML in form of hexadecimal content), I want to search for the new line character and replace it by Space.
    I have used class CL_XML_DOCUMENT to create such document.
    Now, the keyword 'SEARCH' which searches the New Line character, works on the hexadecimal content of the internal table in 46C and I get an XML document. I get the position of the New Line in SY-FDPOS and can do whatever I want. But SEARCH on hexadecimal content is not permitted in ECC 5.0. I get a syntax error when I try to do so. Tried many options but could not succed.
    Would apreciate if anyone can help in finding and replacing characters like new line, tab etc in a hexadecimal string.
    Thanks.
    Can anyone

    Hi!
    When you say hexadecimal string, you mean variable - otherwise string (= character) operations would work?
    Then you have to go for hex handling -> do it yourself. Make something like
    data: lf type x value '0A',
          sp type x value '20',
          i type i.
    I = 0.
    while sy-subrc = 0.
      if hex_string+i(1) = lf.
        hex_string+i(1) = sp.
      endif.
      add 1 to i.
    endwhile.
    Regards,
    Christian

  • New line command in a string?

    I'm trying to go to a new line in the middle of a string. I was told that the command was /n but that's definitely not working. Can anyone help me out? Thanks

    You were close. It's \n. You can do something like
    System.out.println("this is the first line \nthis is the second line");Or you could do this:
    System.out.println("this is the first line");
             System.out.println("this is the second line");The 'ln' on the end of the print statement starts a new line each time.

  • FileUtilsService Write String New Line Character

    Hi All,
    SITUATION:
    Writing a custom log file using the Write String service operation.
    Everytime an event occurs, i want to insert a new line, with date time stamp, details etc.
    PROBLEM:
    In the "value" property of the "write string" service operation... im inputting my relevant data but dont know how to indicate a new line
    WHAT I TRIED:
    I've tried every form of new line character i know: \n, \r, <BR>, \u0000a, \u0000d, ACSII, CRLF, etc, etc... none of them works.
    WHAT I FEAR:
    the exact same situation as http://forums.adobe.com/message/2780658#2780658 ... with a fairly definite answer
    I'm hoping i dont have to go this LONG ugly scary route.
    WAY FORWARD:
    Your thoughts, answers, suggestions....
    Thanking you all in advance.

    if going the "executeScript" way....
    this code worked for me:
    ===========================
    import java.lang.String;
    String vLogEntry = patExecContext.getProcessDataStringValue("/process_data/@logEntry");
    String vLogEntry = vLogEntry + " \r\n";
    patExecContext.setProcessDataStringValue("/process_data/@logEntry", vLogEntry);
    =================

  • Splitting a string on new lines...

    If I want to split string on whitespaces, I do:
    StringTokenizer st = new StringTokenizer(a, " ");If I want to split a string on new lines, (I think the ascii values are "13", "10") how can I do it?
    Thanks a lot!

    does "\n" represents both chr(13) and chr(10) ?No, it does not.
    KajI solved with "\r\n"Did you read the other replies? They are correct when they say that you shouldn't use StringTokenizer.
    Kaj

  • Need to print new line when "," in string

    Hi,
    I have a string having value 12,221,23,67...
    I need to print a new line after ", "
    i;e 12
    221
    23
    67....
    Please suggest.
    Thanks,
    Ajit

    Hi Team ,
    its done.
    I have used chr 13, chr10 and it print new lines for me
    v_serial_num:=v_serial_num||','||CHR(13) || CHR(10)||rec.SERIAL_NUMBER;
    Thanks,
    Ajit

  • What  new line character in string is needed to show new line

    If i need to show java string in a html text area with new lines(that is 2 -3 lines of text ) what new line character i need to add.
    I tried \n and /n but these are not working fine. Can anyone help me.

    If i need to show java string in a html text area
    with new lines(that is 2 -3 lines of text ) what new
    line character i need to add.
    I tried \n and /n but these are not working fine. Can
    anyone help me.HTML ignores line breaks. You will need to use markup (<br>) to force a new line.

  • How to make new-line when printing strings?

    Please help me with code . I can't able to print the string in new line
    Anil

    ... the same question as your other post:
    Printing the string

  • Having problems PrintWriter and new lines in a string

    I apologise if this topic is in the wrong place, but this is my first time asking on these forums.
    At the moment I have a window with an output text area which I want to store the contents of into a file. I use getText() to store the contents to a string, and then write the string to a file using a BufferedWriter. the code is as follows:
    BufferedWriter out = new BufferedWriter(new FileWriter(file));
    String contents = output.getText();
    out.write(contents);
    out.close();The file-name is specified by a FileChooser. All of this works fine, and the text is actually written to the file ok, except that there are no line breaks in it (it's just one continual line of text). I have tried the same process using a string containing "test\ntest" to see if it is just a problem getting the contents of the text area, however it still gives me the same problem.
    Any help on this would be much appreciated.

    Take a look at PrintWriter.
    o See if you can wrap it around a BufferedWriter. (It
    may alrady BE one.)
    o Use it's .println(...) method.That'll still make it appear as one line though. The one-and-only "line" will have the correct platform-specific line terminator (\r\n I suppose), but the string he is writing has embedded \n characters in it, which he is expecting to show up as new lines.
    The OP needs to realize that there really aren't any such thing as "lines". It's all up to the software rendering the text to treat "newline" characters/sequences special. If you were to open that file with a different tool (not Notepad, which only recognizes \r\n as newline sequences), it may display it the way you are expecting.
    Or, you'll have to parse the text and convert it to the proper newline sequences before you write it to the file.

Maybe you are looking for