在 C# 中的某个字符串后提取子字符串

Extract a substring after some string in C#

例如:

INPUT: sample="DA ---- Dear Allowance"
OUTPUT: "Dear Allowance"

我想要 C# 中的这种场景。

如果您所有的字符串都具有与 Code ---- FullName 相同的格式 你可以做到简单-

   string sName = "DA ---- Dear Allowance".Split(new string[]{"----"}, StringSplitOptions.RemoveEmptyEntries)[1].Trim();