Substring from character to character in C#

前端 未结 3 1906
再見小時候
再見小時候 2021-01-21 23:06

How can I get sub-string from one specific character to another one?

For example if I have this format:

string someString = \"1.7,2015-05-21T09:18:58;\";         


        
3条回答
  •  旧巷少年郎
    2021-01-21 23:43

    Use regex,

    @"(?<=,).*?(?=;)"
    

    This would extract all the chars next to , symbol upto the first semicolon.

提交回复
热议问题