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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:29:49+00:00 2026-06-12T04:29:49+00:00

I have a text file which contains the follwing {sno:1c8d1d7eaa32ff3f58a8822111276d5a,at:app,tt:{AppParam1:AppParamValue1,AppParam2:AppParamValue2}},c:{dt:Microsoft XDeviceEmulator,pn:WP,pv:8.0.9832.0} In java I

  • 0

I have a text file which contains the follwing

{"sno":"1c8d1d7eaa32ff3f58a8822111276d5a","at":"app","tt":{"AppParam1":"AppParamValue1","AppParam2":"AppParamValue2"}},"c":{"dt":"Microsoft XDeviceEmulator","pn":"WP","pv":"8.0.9832.0"}

In java I want to find ‘sno’, ‘pn’ and ‘pv’ and replace the values of (what I mean is) currently the above text file has

"sno" has value "1c8d1d7eaa32ff3f58a8822111276d5a"
"pn" has value "WP"
"pv" has value "8.0.9832.0"

New values

"sno" has to be changed to "637829"
"pn"  has to be changed to "XYZ"
"pv" has to be changed to "2.2.4.0"

Your help is much appreciated !
Thanks

  • 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-12T04:29:50+00:00Added an answer on June 12, 2026 at 4:29 am

    You can convert it into JSON, make you changes and then convert it back to string.
    Or if you really want to replace these values by yourself, you can use these lines :

    yourstring = yourstring.replaceFirst("\"sno\":\"[^\"]+\"", "\"sno\":\"637829\"");
    yourstring = yourstring.replaceFirst("\"pn\":\"[^\"]+\"", "\"pn\":\"XYZ\"");
    yourstring = yourstring.replaceFirst("\"pv\":\"[^\"]+\"", "\"pv\":\"2.2.4.0\"");
    

    Only if there are no way theses key can be found elsewhere in the string

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

Sidebar

Related Questions

I have a text file which contains data seperated by '|'. I need to
I have a text file which contains something like this: Hello, my name is
I have a simple text dictionary file, which contains words, separated by ';'.My problem
I have a text file which contains following Name address phone salary Jack Boston
I have tab delim text file which contains the following columns: Probe A_sig A_Pval
I have an HTML file which contains the following line: <div><img src=img1.gif><br>My Text</div> I'm
I have a text file which contains the following: NUM,123 FRUIT DRINK FOOD,BACON CAR
I have an XML file which contains text with some very simple layout constructs:
I have a text.txt file which contains following txt. Kontagent Announces Partnership with Global
I have a text file which contains matrix of N * M dimensions. For

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.