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 7001839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:51:13+00:00 2026-05-27T20:51:13+00:00

I have an output in the console from my code like the sample given

  • 0

I have an output in the console from my code like the sample given below,

... columns=20xs, viewport_supported=true, wta=false, ..., mmf=false
... columns=11xs, viewport_supported=false, wta=false, ..., mmf=true 
... columns=15xs, viewport_supported=true, wta=false, ..., mmf=false

I want to re-arrange it by extracting the common string left to the ‘=’ sign and put it as the column header and its values in its column. How to start doing this in Java?

I am looking for the output like below:

columns      viewport_supported        wta     and so on
  20xs              true              false
  11xs              false             false
  15xs              true              false
  • 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-05-27T20:51:13+00:00Added an answer on May 27, 2026 at 8:51 pm

    I finally was able to do it like this: Split the string using split() method, create a Map dynamic array and assign key and value to the string respectively on either side of the ‘equals to sign’. Then printing the header information by parsing the map representing the first data row and then print all the data rows by iterating the objects from the Map. excerpts from my code is given below.

    /* delimiter */
                String delimiter = ", ";
    

    // given string will be split by the argument delimiter provided.

                String[] temp = capabilities.split(delimiter);
    
                /* print substrings */
                Map<String, String> row = new HashMap<String, String>();
                for (int i = 0; i < temp.length; i++) {
                    String delimiter1 = "=";
                    String[] temp1 = null;
                    temp1 = temp[i].split(delimiter1);
                    if (temp1 != null && temp1.length == 2) {
                        row.put(temp1[0], temp1[1]);
                    }
                }
                dataRows.add(row);
    // print the header --- but first, get the header information by parsing the map representing the first data row
            List<String> fieldNames = new ArrayList<String>();
            Map<String, String> firstRow = dataRows.get(0);
            for (String fieldName : firstRow.keySet()) { 
                fieldNames.add(fieldName);
            }
            for (String fieldName : fieldNames) {
                                System.out.print("\t" + fieldName);
    
            }
    
            // now, print all data rows
            for (Map<String, String> dataRow : dataRows) { 
                System.out.println("\n");
                for (String fieldName : fieldNames) {
                System.out.print("\t" + dataRow.get(fieldName));}
    

    Thank you all for your help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this code on python, that retrieves output from console when executing
I have the following sample code: program boohoo; {$APPTYPE CONSOLE} {$IFDEF boo} {$MESSAGE warn
I have some groovy code like this: def dest = destSql.dataSet('destination_table') sourceSql.eachRow('select * from
In a C# console application, is there a smart way to have console output
Is there a way to have the console focus on the SVN output when
Suppose you have output like this: Word1 Word2 Word3 Word4 Where the number of
Often when writing PHP I'll have it output some HTML like this - echo
x=1 c1=string1 c2=string2 c3=string3 echo $c1 string1 I'd like to have the output be
I am trying to debug a segfault, and I have this output from gdb:
Is it possible to subclass and inherit from javascript Arrays? I'd like to have

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.