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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:45:10+00:00 2026-05-27T13:45:10+00:00

I have this code: string Str = <String><MoreString>; int Start = Str.LastIndexOf(‘<‘) + 1;

  • 0

I have this code:

string Str = "<String><MoreString>";
int Start = Str.LastIndexOf('<') + 1;
int End = Str.IndexOf('>', Start);
string S = Str.Substring(Start, End);

If Str is just "<String>", then it works fine, but if Str is "<String><MoreString>", then it throws an index out of range error. Is it because of the “<“,”>” characters?

  • 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-27T13:45:11+00:00Added an answer on May 27, 2026 at 1:45 pm

    Substring doesn’t work like this.

    Example :

    String myString = "abc";
    bool test1 = myString.Substring(2, 1).Equals("c"); // This is true.
    

    The second argument is the number of characters you’re going to select, so you should do :

    string S = Str.Substring(Start, End-Start);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code void split(vector<float> &fvec, string str) { int place = 0;
I have this code: class MyObj { int Id; string Name; string Location; }
Say i have this PHP code: $FooBar = a string; i then need a
I have this code, int main() { std::string st; std::stringstream ss; ss<<hej hej med
I have this code: field = string.Format(Str, value1, value2, found == true ? fieldName
I have this code to split a string into groups of 3 bytes: str=hello
in my Java code I have this snippet: String str = \\u9601; But I
I have this code to extract title: soup = BeautifulSoup.BeautifulSoup(urllib.urlopen(url)) title = str(soup.html.head.title.string).lstrip(\r\n).rstrip(\r\n) Some
I have this code: void fill_array (unsigned int *iarray, char *string, int max) {
I have this code Dim str As String Dim myConn As SqlConnection = New

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.