Array to one line string

hi i have an array
as this
0123456
6789456
but i want my array to be as 01234566789456...
anyone can help me on tis

Hi jeyanthi,
if you connect your array to the "Concatenate Strings" function, then you get what you want.
Mike

Similar Messages

  • How to auto divide a one-line string into several rows in jsf?

    <h:outputText value="#{msgs.aim}"     styleClass="content_text_darkblue"></h:outputText>
    for example, the #{msgs.aim} will be a long string that one line cannot output. how can i make it auto-break according to the row length instead of show a horizontal scrollbar?
    in raw html code, i know i can include the content inside a <p> tag. but in jsf, i found it impossible to do in this way, although i tried to use <f:verbatim> tag
    can any1 give me some idea about this?

    Hello,
    Why not <h:inputTextarea> ? It makes this automatically for you and you can user readonly="true" to render it as a fictive outputTextarea...
    See example:
    <h:inputTextarea value="#MyBean.description}" rendered="true" required="false" rows="20" cols="80" id="description" readonly="true" />
    Hope you agree.
    sunjavero

  • Reading one line from a text file into an array

    i want to read one line from a text file into an array, and then the next line into a different array. both arays are type string...i have this:
    public static void readAndProcessData(FileInputStream stream){
         InputStreamReader iStrReader = new InputStreamReader (stream);
         BufferedReader reader = new BufferedReader (iStrReader);
         String line = "";          
         try{
         int i = 0;
              while (line != null){                 
                   names[i] = reader.readLine();
                   score[i] = reader.readLine();
                   line = reader.readLine();
                   i++;                
              }catch (IOException e){
              System.out.println("Error in file access");
    this section calls it:
    try{                         
         FileInputStream stream = new FileInputStream("ISU.txt");
              HighScore.readAndProcessData(stream);
              stream.close();
              names = HighScore.getNames();
              scores = HighScore.getScores();
         }catch(IOException e){
              System.out.println("Error in accessing file." + e.toString());
    it gives me an array index out of bounds error

    oh wait I see it when I looked at the original quote.
    They array you made called names or the other one is prob too small for the amount of names that you have in the file. Hence as I increases it eventually goes out of bounds of the array so you should probably resize the array if that happens.

  • Multi-line string - Array?

    I was wondering if someone could tell me how to take a multi-line
    string and dump it into an array. I'm assuming that I use the 'Pick
    Line' function in a while loop? What do I check for to terminate the
    loop?
    Thanks...
    -- N

    "kevin" wrote in message news:...
    > In article <[email protected]>, "Natalia"
    > wrote:
    >
    > > I was wondering if someone could tell me how to take a multi-line string
    > > and dump it into an array. I'm assuming that I use the 'Pick Line'
    > > function in a while loop? What do I check for to terminate the loop?
    > >
    > > Thanks...
    > >
    > > -- N
    >
    > Natalia,
    >
    > Use the 'Spreadsheet String to Array' vi. Use the End of Line delimiter
    > (or carriage return, depends on OS). Add a %s to the format string and
    > POOF!, an instant text array. No loops required. Oh yeah, you also need
    > to add an array string constant to the array type so the output comes ou
    t
    > as a string type instead of the default double.
    >
    > You can do it with you present method if you need the loops for other
    > stuff. To terminate the loop just look for a -1 in the output of 'Pick
    > Line' when searching for you CR or EOL. You just have to remember to dump
    > the last value.
    >
    > good luck,
    > - Kevin
    Kevin -
    Thank you. That did the trick.
    -- Natalia

  • How do I input multiple numbers to go to multiple variables in one line?

    I was wondering what I had to do to input 5 variables on one line. I have the program running fine, but I'm stuck at the part where it says "The numbers will be input five per line, on four lines".. Aside from poor grammar, it doesn't make any sense to me. Here's the whole question:
    Write code that will fill the array twoDArray(declared in the line of code below) with numbers typed in at the keyboard. The numbers will be input five per line, on four lines. Use the following array declaration:I don't need any immediate help with the array itself, just the input (unless the input is directly related to the array). Just in case, I'm going to post my code. This is still very messy, because I'm not done, and it's might be somewhat sloppy as I'm new to 2d arrays (in java).
    Thanks for the help.
    import java.io.*;
    class darrays
    public static void main(String[] args) throws IOException
    InputStreamReader inStream = new InputStreamReader (System.in);
    BufferedReader stdin = new BufferedReader(inStream);
    int[][] twoDArray = new int[4][5];
    int x,y;
    String input;
    for (x = 0; x <= 3; x++)
         for (y = 0; y<=4; y++)
    input = stdin.readLine ();
    twoDArray[x][y] = Integer.parseInt (input);
    for (x = 0; x <= 3; x++)
         for (y = 0; y<=4; y++)
    System.out.print(twoDArray[x][y] + " ");
    System.out.println("");
    }     

    Slightly off-topic
    When I was learning Basic (good old Kemeny & Kurtz style, when Basic was simply a simplified Fortran, not Bill Gates style) you simply have to write
    READ A, B, C, D, E
    DATA 10, 20, 30, 40, 50
    or something like
    INPUT "A", A: INPUT "B", B etc.
    In Java you are required to handle the mysteries of StringTokenizer...
    Java 1.5 is promising to make it easier:
          Scanner sc = Scanner.create(new File("myNumbers"));
          while (sc.hasNextLong()) {
              long aLong = sc.nextLong();
          }where you get the longs (decimal formatted, separated with blanks) from a text file.
    But not so easy as the good old INPUT statement.
    Even C's scanf is not so easy, because has lots of subtleties
    (when you finally mastered the esoteric art of using char* as strings, you are really fed up of char* strings, because they usually blow up due to buffer overflows or mere programmer errors, and start to use Java instead, even having to master the StringTokenizer and other classes.).

  • Multiple input on one line

    Originally had a program to input 5 numbers then put into an array and sort in order. I used seperate lines for each inputted number but want to get the user to put all five numbers on the same line therefore reducing the amount of code. For this I've used args[0] to args[4] as the five different numbers but I now get an arrayindexoutofbounds exception. I can't see where the difference is from the first program to this new one. It's probably an oversight somewhere. Any ideas?
    Thanks,
    Chris
    //The purpose of this is to take 5 numbers from the user and puts numbers into order and also calculates average
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    class Statistics1
         static BufferedReader b;
         public static void main(String[]args)
         throws java.io.IOException
              //Define variables
              b=new BufferedReader(new InputStreamReader(System.in));
              double input_number[]; //creates array called input_number which will be a double
              input_number=new double[5]; //5 elements in array
              double one,two,three,four,five;
              String str; //5 numbers inputted by user
              //This part of the program takes the five inputs from the user and converts them into an integer and puts into array.
              System.out.println("Input 5 numbers and press [Enter]");
              str=b.readLine();
              one=Integer.parseInt(args[0]);
              input_number[0]=one;
              two=Integer.parseInt(args[1]);
              input_number[1]=two;
              three=Integer.parseInt(args[2]);
              input_number[2]=three;
              four=Integer.parseInt(args[3]);
              input_number[3]=four;
              five=Integer.parseInt(args[4]);
              input_number[4]=five;
              //This loop is designed to use the bubblesort method to arrange numbers in order and print them to screen
              double tmp; //has to be double as array is a double
              for(int x=0;x<input_number.length-1;x++)
                   for (int y=x+1;y<input_number.length;y++)
                        if (input_number[x]>input_number[y])
                             tmp=input_number[x];
                             input_number[x]=input_number[y];
                             input_number[y]=tmp;
              for (int x=0;x<input_number.length;x++)
              System.out.println(input_number[x]);
         System.out.println("These are your numbers in order");
              //This loop is to calculate the average and prints to screen
              int e; //representing the individual elements of the array
              double sum=0;
              for(e=0;e<5;e++) //e<5 as arrays are numbered from 0
              sum=sum + input_number[e];
              System.out.println("The average is " + sum/5);
    }

    Sorry about late reply. To explain I'm a complete biff at java and have scoured a few reference books on how to implement the string tokenizer. My effort is below but str1 to str5 don't initialise. Could you please point me in the right direction.
    Thanks again,
    Chris
    //The purpose of this is to take 5 numbers from the user and puts numbers into order and also calculates average
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.util.StringTokenizer;
    class Statistics1
         static BufferedReader b;
         public static void main(String[]args)
         throws java.io.IOException
              //Define variables
              StringTokenizer st=new StringTokenizer(" ");
              b=new BufferedReader(new InputStreamReader(System.in));
              double input_number[]; //creates array called input_number which will be a double
              input_number=new double[5]; //5 elements in array
              double one,two,three,four,five;
              String str; //5 numbers inputted by user
              String str1,str2,str3,str4,str5;
              //This part of the program takes the five inputs from the user and converts them into an integer and puts into array.
              System.out.println("Input 5 numbers and press [Enter]");
              str=b.readLine();
              while(st.hasMoreTokens())
                   str1=st.nextToken();
                   str2=st.nextToken();
                   str3=st.nextToken();
                   str4=st.nextToken();
                   str5=st.nextToken();
              one=Integer.parseInt(str1);
              two=Integer.parseInt(str2);
              three=Integer.parseInt(str3);
              four=Integer.parseInt(str4);
              five=Integer.parseInt(str5);
              input_number[0]=one;
              input_number[1]=two;
              input_number[3]=three;
              input_number[4]=four;
              input_number[5]=five;
              //This loop is designed to use the bubblesort method to arrange numbers in order and print them to screen
              double tmp; //has to be double as array is a double
              for(int x=0;x<input_number.length-1;x++)
                   for (int y=x+1;y<input_number.length;y++)
                        if (input_number[x]>input_number[y])
                             tmp=input_number[x];
                             input_number[x]=input_number[y];
                             input_number[y]=tmp;
              for (int x=0;x<input_number.length;x++)
              System.out.println(input_number[x]);
         System.out.println("These are your numbers in order");
              //This loop is to calculate the average and prints to screen
              int e; //representing the individual elements of the array
              double sum=0;
              for(e=0;e<5;e++) //e<5 as arrays are numbered from 0
              sum=sum + input_number[e];
              System.out.println("The average is " + sum/5);
    }

  • How to get the results in one line

    Hi
    if i use the script below i get the name of path and then : and in next line i get the results.is there a way to get the results from every path after the : and not in the next line?
    another question - is there a way that the script will not show the server name on every path?
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances | Get-Counter
    THC

    If you take you script and pipe it to get member, it will give you a list of various script properties.
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances | Get-Counter | get-member
    You will see that the object type returned by "Get-Counter" is Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSampleSet.
    TypeName:
    Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSampleSet
    Name MemberType Definition
    Equals Method bool Equals(System.Object obj)
    GetHashCode Method int GetHashCode()
    GetType Method type GetType()
    ToString Method string ToString()
    CounterSamples Property Microsoft.PowerShell.Commands.GetCounter.Perfo...
    Timestamp Property datetime Timestamp {get;set;}
    Readings ScriptProperty System.Object Readings {get=$strPaths = ""...
    You can try grabbing different properties, and they will print out differently, displaying the data on the same line in some cases. For example, pipe your output to a "foreach-object" block, and then for each object print out the CounterSamples property.
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances | Get-Counter | foreach-object { ($_).CounterSamples }
    This should all print on one line now. However, you also asked if there was a way to not have the server print out on every line. The way to control the format of these outputs is to use the "format-table" cmdlet. So you would pipe your output to format-table
    and then give it various options. This is how you would pipe it (without any options).
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances |
    Get-Counter | object { ($_).CounterSamples | format-table }#OR USE YOUR ORIGINAL CODE(Get-Counter -ListSet LogicalDisk).PathsWithInstances |
    Get-Counter | format-table }
    Now, it's up to you to give format-table the options you want. With no options, output will look unchanged. To see what options are available to you, use get-help.
    get-help format-table
    I hope this helps!
    Thank for all the info...

  • About combing two array into one

    Hi all,
      I post a questiona bout converting an array of integer into char (byte) array and I got a solution already http://forums.ni.com/t5/LabVIEW/how-to-display-char-code-properly/m-p/2596087#M780368
    However, I enouther another problem while dealing with an array of  U16 type. I would like to extract the high and low byte from numbers (U16) stored in array. I extract the high and low byte for each U16 number and convert them as char, concatenate them to a string. Repeat this process for each element in the array so to get a big string with each element is a char for high and low byte. My code is enclosed as follows
    It works fine but I am concerning the speed. Is that any other way to do it fast and don't use loop (in real case, I will deal with pretty big array many times, efficiency is a problem). Note that the high and low bytes array extracted from the original array with the module Split number.vi, but how can I combine these two array in one code with data arranged as high-low-high-low ... ? Thanks.
    Solved!
    Go to Solution.

    PKIM wrote:
    However, I enouther another problem while dealing with an array of  U16 type. I would like to extract the high and low byte from numbers (U16) stored in array. I extract the high and low byte for each U16 number and convert them as char, concatenate them to a string. Repeat this process for each element in the array so to get a big string with each element is a char for high and low byte. My code is enclosed as follows
    It works fine but I am concerning the speed. Is that any other way to do it fast and don't use loop (in real case, I will deal with pretty big array many times, efficiency is a problem). Note that the high and low bytes array extracted from the original array with the module Split number.vi, but how can I combine these two array in one code with data arranged as high-low-high-low ... ? Thanks.
    You need to be more clear.
    Looking at the code, you are dealing with I16, not U16. Also your index array primitives could be replaced by autoindexing. Your use of the feedback node only makes sense if you want to append strings forever with stale data, thus growing data structures without limits. If you only want to convert the current data, remove the feedback mode and use a "concatenate strings" with a single input. A for loop is one of the most efficient data structures and using it is not a problem. One way or another the code needs top oerate on all data.
    All that said, I agree with Tim that most likely all you need to do is insert a typecast after the "to I16" and eliminate all other code.
    LabVIEW Champion . Do more with less code and in less time .

  • My test instrument is outputting a 5 line string but labview only read until the carriage return. how can I get it to read the whole string?

    I have a labview sub-VI reading the string being outputted by a pH meter.  The meter outputs a 5 line string and labview is only reading up to each lines carriage return, there-by giving me 5 separate strings is there anyway to rectify this and have the 5 line read as one string?
    NAS1
    St Petersburg FL
    Labview 2010

    Yes, LabVIEW will automatically update. What happens is that the old serial functions still exist in 7.1 and above but the code (the block diagram) has been modified to use VISA functions. Older versions of LabVIEW are fully supported in this manner. The only way you can avoid the automatic update is to have the old serial functions in an llb and your top level VI refer to these. Having any VI that was part of vi.lib in an llb is a very bad idea and the way to fix things is to remove any VIs in the llb that are part of the LabVIEW distribution.
    I don't remember how the old serial config worked and what the new version does with the VISA Configure Serial Port. Your program should only have a single serial config and you might just be able to directly replace that with the VISA configure Serial Port.

  • Reading in one line at a time.

    How can I read one line at a time?
    String sData = "One large string"
    StringReader reader = new StringReader(sData);
    StringBuffer buf = new StringBuffer();
    String line = "";
    while ((line = reader.toString()) != null) {//This line does not read one line at a time. Is it possible to do the with StringReader?
    StringTokenizer tok = new StringTokenizer(line, "|");
    Thanks:0)

    The following code snippet does what you want :-)
            String test = new String("testString \n with \n multiple lines");
            StringReader strReader = new StringReader(test);
            BufferedReader strBufRdr = new BufferedReader(strReader);
            String line = null;
            try {
                while((line=strBufRdr.readLine())!=null) {
                    System.out.println(line);
            catch(IOException e) { System.out.println(e); }Have fun!

  • 'Calendar UI' which will display current month's calendar in one line

    Hi Experts,
    I have to create a calendar in following way. Here I have to display calendar of current month for the employee. The entire month detail has to appear in one line. In fact it is needed for Leave Overview iView.
    Manager needs to view the Leave details of all employees working in his department
       1                 2                  3              4           5         6                 7              8            9               10   11     12     13     14     15  16 17 18 19  20 21  22 23  24  25  26  27  28  29 30 31
       Mon    Tues    Wed    Thurs   Friday  Sat            Sun
    Smith  
    Marteen
    Thomas
    I am not sure how to do it? Do we have any ready made UI element which we can use. I can see Date navigator. However it
    displays the calendar in 4 rows.
    Please help.
    Regards,
    Gary

    Hi Abhinav, Experts
    Thanks. The design of my RFC will be like this:
    1) Input Org Unit, Month, Year
    2) Output
    Pernr (datatype number 8)
    Name (datatype string)
    Day1 (datatype string)
    Day2 (datatype string)
    Day3 (datatype string)
    Day4 (datatype string)
    Day29 (datatype string)
    Day30 (datatype string)
    Day31 (datatype string)
    3) The default value Day1, Day2  etc will be null
    4) I will find out Leave Details. If Leave has been approved for say Day5 then I will populate Day5 = 'AP'.
    5) I will write another logic to make the color of cell as 'Green' for Day5.
    6) In Feb 2011, there are 28 days. There will be another logic to make the Day29, Day30, Day31 invisible for months like Feb 2011.
    Please let me know if this approach is correct.
    Please also let me know how to display day i.e. 01.04.2011 is Friday. In Calendar I have to display
                     1.4.2011  2.4.2011   3.4.2011
                     Friday      Saturday   Sunday
    Smith
    Tony
    I did small Proof of Concept. The table does not look good although displays the information.
    Please help.
    Regards,
    Gary

  • Listbox one line at a time

    I want to add one line at a time in listbox/textbox just like InsertTextboxLine funtion in CVI. I can not find similar VI in labview. I think I can do it long way...by saving listbox to an array then append my line at the end of the array and send updated array to listbox..these are lot of steps to add one line to listbox/textbox...
    Any help would be appreciated.
    Thanks.
    CVI 2010
    LabVIEW 2011 SP1
    Vision Builder AI 2011 SP1

    Actually, the way to append an item to a list box is to create an Item Names property node for the list box.  Then you can use Insert Into Array, and write to another property node for Item Names.
    Message Edited by tbob on 10-03-2005 02:31 PM
    - tbob
    Inventor of the WORM Global
    Attachments:
    ListBox.PNG ‏3 KB

  • How to do the multiple-line String at JList? help!

    i need some code to multiple-line String at JList.
    i know that it is can be done by html code.
    example:
    <p>line1</p><p>line2</p>
    but if i use that html code...
    i face another problem to my JList..
    it cannot set the font use the ListCellRenderer..
    like:
    public Component getListCellRendererComponent(
    JList list,
    Object value,
    int index,
    boolean isSelected,
    boolean cellHasFocus)
    Color newColor = new Color(230, 230, 230);
    setIcon(((DisplayItem)value).getIcon());
    setText(((DisplayItem)value).getChat());
    setFont(((DisplayItem)value).getFont());
    setBackground(isSelected ? newColor : Color.white);
    setForeground(isSelected ? Color.black : Color.black);
    if (isSelected) {
    setBorder(
    BorderFactory.createLineBorder(
    Color.red, 2));
    } else {
    setBorder(
    BorderFactory.createLineBorder(
    list.getBackground(), 2));
    return this;
    all my JList will be html type...
    i don't want that happen..can be another method to do that multiple-line String in JList??
    i also need to set a icon image between string in the JList. anyone get idea??
    i need ur help!
    thank you.

    I think you should create/override several methods like setText(String), setIcons(Icon[]), paintComponent(Graphics), getMinimumSize(), getPreferredSize(), etc.
    I would like to code like below...:class MultilineLabel extends JLabel {
        private String[] text = null;
        private ImageIcon[] icons = null;
        public void setText( String newText ) {
            // It overrides JLabel.setText( String )
            // Tokenize newText with line-separator
            // and put each text into the 'text' array.
        public void setIcons( Icon[] newIcon ) {
            // It is similar to JLabel.setIcon( Icon ) method,
            // but it receives an array of Icon-s. Set these icons to 'icons' variable.
        public void paintComponent( Graphics g ) {
            // It overrides JComponent.paintComponent( Graphics ) method.
            super.paintComponent( g );
            if ( text != null && icons != null ) {
                int icon_x = 0;
                int text_x = 0;
                int y = 0;
                // draw customized content..
                for ( int i=0; i<text.length; i++ ) {
                    // compute x and y locations
                    // icon_x = ...
                    // text_x = ...
                    // y = ...
                    // and draw it!
                    g.drawString( text[ i ], text_x, y );
                    icon[ i ].paintIcon( this, g, icon_x, y );
        public Dimension getMinimumSize() {
            int width = super.getMinimumSize().width;
            int height = ... // I think you must compute it with 'text' and 'icons'' arrays.
            return new Dimension( width, height );
        public Dimension getPreferredSize() {
            int width = super.getPreferredSize().width;
            int height = ...
            return new Dimension( width, height );
    }I think that code-structure above is the minimum to implement your requirements. (Of course if you want to implement it :)
    Good luck and let me know it works or not. :)

  • More than one line beside a category icon

    Hello,
    I have in a page placed the text item category icon, and space a then the display name of the item. The problem is that as the text of the display name is too long when it makes an automatic return makes it under the category icon. It seems to be a problem with the number of text lines that can be placed beside the category icon.
    How can I make that the category icon accepts more than one line of text beside it?
    Thanks in advance,
    Izzat Sabbagh
    ITC

    I'm sure you can use html, like
    String tooltip = "<html>first line<br>second line</html>";Perhaps it works without html if you use newline '\n'.

  • OWA Email - One Long String

    The email I receive from OWA has no line breaks, it is all one long string.  This is creating a big problem when I forward the emails received with my BB as they are difficult to read by the recipient.  Is there anyway to correct this?  I use BIS and access my work email via OWA.  I also have a separate personal email set up with no problems with the email I receive or send.  
    BB Curve 8310 v4.5.0.55
    OWA v5.5 SP4
    Any help will be appreciated!

    I'm experiencing the same issue (no line breaks) when pasting rows directly from Excel (2008 & 2011) into a Flex TextArea on a Mac. However, when pasting the exact same data from a Windows Excel spreadsheet, it contains the line breaks.
    From Mac: Customer\tPhoneCustomer 1\t555-555-5555Customer 2\t555-555-5556
    From Windows: Customer\tPhone\rCustomer 1\t555-555-5555\rCustomer 2\t555-555-5556\r
    This appears to be a bug in a flash.display class as pasting the data from Excel to a text editor and then copying/pasting into the same Flex TextArea preserves the original line breaks.
    Has anyone figured out a work around?

Maybe you are looking for