Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8393455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:47:31+00:00 2026-06-09T19:47:31+00:00

I am receiving a countless long string from client like 1 15/8/2012 15:00 palak

  • 0

I am receiving a countless long string from client like “1 15/8/2012 15:00 palak paneer 2 200 dam aaloo 2 100” and so my requirement is I want this string in a table format like:

1""""""""""""""""""""""           ''''''''''''''''''''''''''''''''''''''''''''         15/8/2012 15:00

palak paneer """""""""""""   2 """""""""""""""""   200

dam aaloo '''''''''''''''''''''''''''      2   '''''''''''''''''''''''''''' 100

and so on.

Any help would be appreciated.
What should I use in order to put a whole string into table format and I don’t know the length of string, so we can not use hard coded values.

I have tried the string.split function and I have got an array of strings but as I said the length of string is not fixed so we can not do hard coding so what should I have used?

This is my attempt:

recieved =modifiedSentence.split("~");
int length = 0;
length = recieved.length;
modifiedSentence = modifiedSentence.substring(length);
String string =String.format("%+s %+4s",recieved[0],recieved[1]);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:47:33+00:00Added an answer on June 9, 2026 at 7:47 pm

    this code might help you, it splits up the received string to rows.

        int start=0; 
        String[] rows=new String[10];
        int colCount=0;
        int rowCount=0,i;
        String str="";
        String received="1 15/8/2012 15:00 palak paneer 2 200 dam aaloo 2 100 a a a 3 4";
        String splittedStrs[]=received.split("[a-z]");
        String header=splittedStrs[0].trim(); 
        received=received.substring(header.length()+1);
        boolean prev=false;
        for ( i = 0; i < received.length(); i++) {
            char c=received.charAt(i);
            if(c==' '){ 
                if(str.matches("\\D+")){                        
                    prev=true; 
                    str="";
                }
                else{
                    if(prev==true){ 
                        colCount++;
                        if(colCount==3){
                            rows[rowCount]=received.substring(start,i);
                            rowCount++; 
                            start=i+1;
                            colCount=0;
                        } 
                    }
                    colCount++;
                    if(colCount==3){
                        rows[rowCount]=received.substring(start,i);
                        rowCount++;
                        start=i+1;
                        colCount=0;
                    }
                    prev=false;
                    str="";
                }
            } 
            else{
                str=str.concat(c+"");
            }
        }
        rows[rowCount]=received.substring(start,i);
    
        System.out.println("Header ="+header);
        for ( i = 0; i <= rowCount; i++) {
            System.out.println(rows[i]);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In receiving iCal events from Outlook, it is specifying the timezone in the long
I'm receiving a string a=100,b=20,c=20; for instance I know exploding this into an array
I am receiving JSON string response from my WCF service. I wanna parse this
I am receiving e-mails set from a normal GUI client such as thunderbird or
I keep receiving this error... [2012-06-14 11:54:50,072: ERROR/MainProcess] Hard time limit (300s) exceeded for
After receiving very good correction from fuzzy lollipop, I amended my code to create
I'm receiving errors from Gtk that I can't track down. Every time my mouse
My app is receiving data from a BlueTooth device 4 times a second, parsing
Receiving the following error when doing a simple calendar fetch: Expected response code 200,
I am receiving a set of models from my SQLite Database with Ruby on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.