Vik*_*ren 1 c# arrays join substring
private static string SetValue(string input, string reference)
{
string[] sentence = input.Split(' ');
for(int word = 0; word<sentence.Length; word++)
{
if (sentence[word].Equals(reference, StringComparison.OrdinalIgnoreCase))
{
return String.Join(" ", sentence.subarray(word+1,sentence.Length))
}
}
}
Run Code Online (Sandbox Code Playgroud)
如何sentence.subarray(word+1,sentence.Length)轻松完成或以其他方式完成此操作?
return String.Join(" ", sentence, word + 1, sentence.Length - (word + 1));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
957 次 |
| 最近记录: |