我正在try 在C#中提取字符串之前的数字.而不是字符串之间或之后的数字.字符串前只有数字. 我需要结果.
- DOROSły==>;0或""
- ==同步,由Elderman更正==@elder_man
- ==引用=外部链接==
- 9-骨瘦如柴=>;9
我在C#上try 了Regex,但得到了"";
string test =Regex.Match("1-osobowy", @"/^(\d)-.*/m").Value;
我正在try 在C#中提取字符串之前的数字.而不是字符串之间或之后的数字.字符串前只有数字. 我需要结果.
我在C#上try 了Regex,但得到了"";
string test =Regex.Match("1-osobowy", @"/^(\d)-.*/m").Value;
试试这个:
string test = Regex.Match("1-osobowy", @"^\d+").Value;