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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:17:00+00:00 2026-06-12T09:17:00+00:00

We tried a few solutions now that try and use XML parsers. All fail

  • 0

We tried a few solutions now that try and use XML parsers. All fail because the strings are not always 100% valid XML. Here’s our problem.

We have strings that look like this:

var a = "this is a testxxx of my data yxxx and of these xxx parts yxxx";
var b = "hello testxxx world yxxx ";

"this is a testxxx3yxxx and of these xxx1yxxx";
"hello testxxx1yxxx ";

The key here is that we want to do something to the data between xxx and yxxx. In the example above I would need a function that counts words and replaces the strings with a word count.

Is there a way we can process the string a and apply a function to change the data that’s between the xxx and yxxx? Any function right now as we’re just trying to get an idea of how to code this.

  • 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-12T09:17:00+00:00Added an answer on June 12, 2026 at 9:17 am

    You can use Split method:

     var parts = a.Split(new[] {"xxx", "yxxx"}, StringSplitOptions.None)
                .Select((s, index) =>
                    {
                        string s1 = index%2 == 1 ? string.Format("{0}{2}{1}", "xxx", "yxxx", s + "1") : s;
                        return s1;
                    });
    
      var result = string.Join("", parts);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried this a few different ways and it always seems to fail.
I've tried a few ways to try to do this but none of them
I've tried a few Asus Ones, and found that even switching between multiple windows
I been sitting over this problem quiet a few hours now and can not
I have a problem that has been bothering me now for a few days.
I tried a few of the fixes I found here searching around but they
I am trying to determine a file's mime type. I've tried a few methods,
I am using http://xpath.online-toolz.com/tools/xpath-editor.php as an online XPath evaluator. I tried a few others
Looking for something like: $(input:radio:checked).previous(name, original_name).attr(name,new_name); I tried a few different seen around here
I have tried quite a few codes but none of them seem to work

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.