Need to get a string after a “word” in a string in c#

前端 未结 7 1592
被撕碎了的回忆
被撕碎了的回忆 2020-12-08 13:45

i\'m having a string in c# for which i have to find a specific word \"code\" in the string and have to get the remaining string after the word \"code\".

The string i

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 14:04

    add this code to your project

      public static class Extension {
            public static string TextAfter(this string value ,string search) {
                return  value.Substring(value.IndexOf(search) + search.Length);
            }
      }
    

    then use

    "code : string text ".TextAfter(":")
    

提交回复
热议问题