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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:29:06+00:00 2026-06-15T08:29:06+00:00

How to use StringBuilder in this code. string strFunc = data /*dsdsds */ data1

  • 0

How to use StringBuilder in this code.

        string strFunc = "data /*dsdsds */ data1 /*sads dsds*/";
        while (strFunc.Contains("/*"))
        {
            int tempStart = strFunc.IndexOf("/*");
            int tempEnd = strFunc.IndexOf("*/", tempStart);

            if (tempEnd == -1)
            {
                tempEnd = strFunc.Length;
            }
            strFunc = strFunc.Remove(tempStart, tempEnd + 1 - tempStart);
        }

Logic is to remove commanded data from string

  • 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-15T08:29:08+00:00Added an answer on June 15, 2026 at 8:29 am

    What you want to do is something like

    string strFunc = "data /*dsdsds */ data1 /*sads dsds*/";
    Regex reg = new Regex(@"/\*.+?\*/"); 
    strFunc = reg.Replace(strFunc, String.Empty);
    

    no StringBuilder is required here.

    However, to provide an example to the use of a StringBuilder: to create a string which holds the removed ‘commands’, you could write

    MatchCollection commands = reg.Matches(strFunc);
    StringBuilder sb = new StringBuilder();
    foreach (Match m in commands)
        sb.Append(m.ToString());
    

    but you will have to beware of formatting here.

    I hope this helps.

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

Sidebar

Related Questions

I have this code: public void Contacts(string domainToBeTested, string[] browserList, string timeOut, int numberOfBrowsers)
I have something like this in my code: String boundary = thisIsMyBoundaryString; StringBuilder body
I use this code to transform XML to HTML using XSLT template: string uri
I'm trying to use stringbuilder to create a body of string to be used
What is better to use for Exception output message dynamic generation String or StringBuilder
I use Twitter Widget in my application [asp.net c#]. My code is: StringBuilder strTwittsViewer
I know that StringBuilder is more efficient than a normal string when processing code
I use this code below, it works perfectly in Android 2.3.3. However, in 4.0+
I'm wondering if this code ... StringBuilder sb = new StringBuilder(Please read the following
I want to create a string object like this string data = 85-null-null-null-null-price-down-1-20; //

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.