2
I have the following code:
copia = num.Text;
copia = copia.Substring(cobrar.Length + 1, copia.Length);
num.Text = copia;
Where copia
receives a string from a textbox and cobrar
is a predefined string, I want it to "delete" the string cobrar
of my string copia
.
Example:
cobrar = "teste";
copia = "numero";
num.Text = cobrar + copia; //não é só isso, por isso quero remover com o Substring
resultado seria = "numero";
When I run the program it closes at that time, the IDE tells me to look at my startIndex that it would charge. Length .. What error am I commenting on?
Dude, improve your example a little bit and I’ll help you. It’s still kind of confusing.
– Jéf Bueno
It already worked, bro, this is a little harder to explain than the other one, but it would be to remove part of a string. My main string is the union of two or three string, hence I wanted to remove a string from this main string.
– Leonardo