本文介绍了如何从给定的字符串行中提取字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个像这样的字符串
Hi,
I have a string like this
C:\TEMP\FDB2\27JUN2012.TEL136430D\NDDF PLUS DB\NDDF Plus DB
,我想从其中提取一个部分,例如
and I want to extract a part from this like
27JUN2012.TEL136430D
. Plz指南我该怎么做?
在此先感谢
. Plz Guide how can i do this ?
Thanks in advance
推荐答案
string inp = "C:\TEMP\FDB2\27JUN2012.TEL136430D\NDDF PLUS DB\NDDF Plus DB"
string[] parts = inp.Split('\\');
然后,这取决于路径的组织方式:如果它始终是您想要的第三部分,那么
Then it depends on how your paths will be organised: if it is always the third part you want, then
Console.WriteLine(parts[2]);
将其提供给您.否则,您将必须查看每个部分,并确定其是否符合您的标准.在不了解更多标准的情况下,我不能说!
Will give it to you. Otherwise, you will have to look at each part and see f it matches whatever your criteria are. Without knowing more about the criteria, I can''t say!
这篇关于如何从给定的字符串行中提取字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!