我想在读取第一个和最后一个字母后在 c# 中剪切一个字符串。
string name = "20150910000549659ABCD000007348summary.pdf";
string result = "ABCD000007348"; // Something like this
string name = "1234 ABCD000007348 summary.pdf";
读完 1234 后“A”出现,最后“s”出现所以我想要“ABCD000007348”
最佳答案
只需使用正则表达式:
string CutString(string input)
{
Match result = Regex.Match(input, @"[a-zA-Z]+[0-9]+");
return result.Value;
}
关于c# - 读取第一个和最后一个字母后解析c#中的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32696540/