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

  • Home
  • SEARCH
  • 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 8954899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:25:04+00:00 2026-06-15T14:25:04+00:00

I have a problem at the line String fromIndexString = topStiva.Substring(topStivaLength + 1, topStiva.Length);

  • 0

I have a problem at the line String fromIndexString = topStiva.Substring(topStivaLength + 1, topStiva.Length); . I shows that topStiva.Length is out or range.

The code is as follows:

String actiuneRezultata(String topStiva, String cuvIntr) {

        int index = -1;

        String primulCharCuvIntr = cuvIntr.Substring(0, 1);

        if (primulCharCuvIntr.Equals("+") == true)
            primulCharCuvIntr = "\\" + primulCharCuvIntr;

        else
            if (primulCharCuvIntr.Equals("*") == true)
                primulCharCuvIntr = "\\" + primulCharCuvIntr;

        else
            if (primulCharCuvIntr.Equals("*") == true)
                primulCharCuvIntr = "\\" + primulCharCuvIntr;

        else
            if (primulCharCuvIntr.Equals("*") == true)
                primulCharCuvIntr = "\\" + primulCharCuvIntr;

        else
            if (primulCharCuvIntr.Equals("*") == true)
                primulCharCuvIntr = "\\" + primulCharCuvIntr;

        for (int i = 0; i < ta.Length; i++) {

            if (ta[i].CompareTo(primulCharCuvIntr) == 0) {

                index = i;
                break;
            }
        }

        int topStivaLength = topStiva.Length - 1;

        while (topStiva[topStivaLength] >= '0' && topStiva[topStivaLength] <= 9)
            topStivaLength--;

        String fromIndexString = topStiva.Substring(topStivaLength + 1, topStiva.Length);
        int fromIndex = int.Parse(fromIndexString);

        if (index < 0)
            return "Nu face parte din gramatica!";
        else
            return tabela[fromIndex][index];

    }

The value topStiva is gets it from the call actiuneRezultata(stivaAPD.Peek().ToString(), another_value)

I saw that in stivaAPD I am geeting after push some values. So why is it that is out of range? Pls help!

  • 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-15T14:25:06+00:00Added an answer on June 15, 2026 at 2:25 pm

    The second argument to String.Substring is the length of the desired substring. You seem to be calling it as if it were instead the (exclusive) end index of the substring. Try calling the following so that your length is equal to the distance to the end index of the string.

    topStiva.Substring(topStivaLength+1, topStiva.Length - (topStivaLength+1));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a problem where Java is telling me that the following line
I have a 1.2GB file that contains a one line string. What I need
I have a php parser that split a given string by line-breaks, doing something
I have done Muticolum listview onListItemClick .Its working fine.Problem is This line String selection
I have got a problem with multi line data (data that contains newline \n).
Here my problem is: I have this code: static long CountLinesInFile(string f) { long
I have a problem with this code. This is a tutorial code that show
I have a problem. I have lots of code that uses ifstreams in this
I have this problem when I run SAS 9.2 on the command line on
I have a problem with my colorscheme in vim: (source: tinygrab.com ) The line

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.