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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:09:23+00:00 2026-05-29T06:09:23+00:00

If I have a string such as the following: String myString = SET(someRandomName, \hi\,

  • 0

If I have a string such as the following:

 String myString = "SET(someRandomName, \"hi\", u)"; 

where I know that "SET(" will always exists in the string, but the length of "someRandomName" is unknown, how would I go about deleting all the characters from "(" to the first instance of """? So to re-iterate, I would like to delete this substring: "SET(someRandomName, \"" from myString.

How would I do this in C#.Net?

EDIT: I don’t want to use regex for 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-05-29T06:09:24+00:00Added an answer on May 29, 2026 at 6:09 am

    Providing the string will always have this structure, the easiest is to use String.IndexOf() to look-up the index of the first occurence of ". String.Substring() then gives you appropriate portion of the original string.

    Likewise you can use String.LastIndexOf() to find the index of the first " from the end of the string. Then you will be able to extract just the value of the second argument ("hi" in your sample).

    You will end up with something like this:

    int begin = myString.IndexOf('"');
    int end = myString.LastIndexOf('"');
    string secondArg = myString.Substring(begin, end - begin + 1);
    

    This will yield "\"hi\"" in secondArg.

    UPDATE: To remove a portion of the string, use the String.Remove() method:

    int begin = myString.IndexOf('(');
    int end = myString.IndexOf('"');
    string altered = myString.Remove(begin + 1, end - begin - 1);
    

    This will yield "SET(\"hi\", u)" in altered.

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

Sidebar

Related Questions

I have a string that's of the following scheme: VersionNumber.VersionString-VersionNumber.VersionString Such that the following
Say i have a string that i need to evaluate in javascript such as
I have a string such as the following: Are you looking for a quality
I would like to have a function called GetMethodName such that the following code
I have an input string that's generated as in following example: string.Format(Document {0}, was
I have the following string in JavaScript var mystring = abcdef(p,q); check(x,y); cef(m,n); I
I have string such as following : +10:30 , +04:50 , -10:20 which are
I have a variable string like such: [Text that changes]:SPACE: where the :SPACE: is
I have the following string in database: SET @Value = [4888378977CA4A5] Test String Also,
I have a string such as big bad dog, how can I get an

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.