Substring error: System.Argued tofrangeexception

Asked

Viewed 17 times

0

I couldn’t understand how the calculation of substring in c#;

The variable below contains 150 characters, I use the substring to receive a part of it, but an exception occurs even being within reach. How the parameters of substring?

string conteudo = "Morbi laoreet congue eros, eu elementum lacus dapibus sit amet. Praesent scelerisque, sapien ut efficitur dapibus, ante ligula aliquam lorem, in faucibus ante tortor ac turpis. Fusce lobortis enim ac dui sodales, suscipit ultricies odio dapibus. Sed semper sapien eu tortor imperdiet dapibus. Nunc dictum pellentesque nisi, ac posuere felis luctus in. Sed eu est quis massa pretium condimentum vel sed justo. Aliquam pellentesque in tellus at tristique.";

conteudo.Substring(70,100); //erro
  • The only mistake I saw in your code is the lack of ; at the end of the first line.

  • I only used this code as an example

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.