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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:52:36+00:00 2026-06-14T21:52:36+00:00

From a server, I get strings of the following form: String x = fixedWord1:var1

  • 0

From a server, I get strings of the following form:

String x = "fixedWord1:var1 data[[fixedWord2:var2 fixedWord3:var3 data[[fixedWord4]    [fixedWord5=var5 fixedWord6=var6 fixedWord7=var7]]] , [fixedWord2:var2 fixedWord3:var3 data[[fixedWord4][fixedWord5=var5 fixedWord6=var6 fixedWord7=var7]]]] fixedWord8:fixedWord8";

(only spaces divide groups of word-var pairs)
Later, I want to store them in a Hashmap, like myHashMap.put(fixedWord1, var1); and so on.

Problem:
Inside the first "data[......]"-tag, the number of other "data[..........]"-tags is variable, and I don’t know the length of the string in advance.

I don’t know how to process such Strings without resorting to String.split(), which is discouraged by our assignment task givers (university).

I have searched the internet and couldn’t find appropriate websites explaining such things.
It would be of great help, if experienced people could give me some links to websites or something like a “diagrammatic plan” so that I could code something.

EDIT:
got mistake in String (off-topic-begin “please don’t lynch” off-topic-end), the right string is (changed fixedWord7=var7 —to—> fixedWord7=[var7]):

String x = "fixedWord1:var1 data[[fixedWord2:var2 fixedWord3:var3 data[[fixedWord4]    [fixedWord5=var5 fixedWord6=var6 fixedWord7=[var7]]]] , [fixedWord2:var2 fixedWord3:var3 data[[fixedWord4][fixedWord5=var5 fixedWord6=var6 fixedWord7=[var7]]]]] fixedWord8:fixedWord8";
  • 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-14T21:52:38+00:00Added an answer on June 14, 2026 at 9:52 pm

    I assume your string follows a same pattern, which has “data” and “[“, “]” in it. And the variable name/value will not include these strings

    1. remove string “data[“, “[“, “]”, and “,” from the original string

      replaceAll("data[", "")
      replaceAll("[", "")
      etc
      
    2. separate the string by space: ” ” by using StringTokenizer or loop through the String char by char.

    3. then you will get array of strings like

      fixedWorld1:var1
      fixedWorld2:var2
      ......
      fixedWorld4
      fixedWorld5=var5
      ......
      
    4. then again separate the sub strings by “:” or “=”. and put the name/value into the Map
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to get data from the Server and if the
I get json string from server. Then I parser it using SBJSON library. But
I get an image from a PHP server as a string ( this image
I get data from server: store = new dojox.data.QueryReadStore({url:http://url_with_data}); ... myGrid = new dojox.grid.DataGrid({id:myGrid2,selectionMode:none,style:height:
In my project ,I get json data from Server,there's a field named 'creat_at' in
I am using jQuery to get data from server. Data is coming. Here what
i am developing an app in which i get data from server and display
I am using the following code to get time from the server. The btnNoP
in ext.net library, how can I get from server side code the double clicked
I tried to get an answer from server and conver it to JSONObject .

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.