Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个格式为:
ABCDEFGHIJKLMN-OOOOOO
如何在 c# 中将字符串值截断为以下值?
ABCDKLMNOOOOOO
希望指教
好的,我将猜测一下逻辑规则。怎么样:
string newStr = str.Substring(0,4)+str.Substring(10,4)+str.Substring(15,6);
或者你可能想要
string newStr = str.Substring(0,4)+str.Substring(10,4)+str.Split("-")[1];
你可能想要很多东西