len = int.Parse(tE1Clt.Text);
front=int.Prase(tE_Fstng.text);
string result = tE3_Series.Text.Substring(front, len);
tE1_Sub.Text = result.ToString();
我收到错误
[index and length must refer to a location within the string. Parameter name: `length`]
答案 0 :(得分:1)
if(TeInput.Text.Length> 1) {
string Input = TeInput.Text, Store1 = string.Empty, store2 = string.Empty;
int Start = 0, End = 0;
Start = int.Parse(TeStart.Text);
End = int.Parse(TeEnd.Text);
string Output = TeOutput.Text;
Store1 = Input.Remove(0, Start).Trim();
store2 = Store1.Remove(Store1.Length-End).Trim();
TeOutput.Text = store2;
答案 1 :(得分:0)
你可以这样做,
var str = "----takemeout----";
var start = str.IndexOf('t'); // start index of first t
var length = 9; // length of takemeout string
var result = str.Substring(start, length);
价值或结果将是“takemeout”