Answer the question
In order to leave comments, you need to log in
How to remove the last character of a string without using the Remove method?
Suppose we have code that will throw an argumentoutofrangeexception if the length of the string exceeds the maximum allowed value of the int type, since there is no override for the Remove method for larger types of variables than int:
if (_input[0] == _input[_input.Length - 1]) {
_input = _input.Remove(0, 1);
_input = _input.Remove(_input.Length - 1); // 1. Required to be replaced
}
Question: Is there a method for String that can replace a line marked with a comment if the code below is guaranteed to print false to the console?
Console.Writeline(Int32.MaxValue >= _input.Length );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question