Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 Guide how can i do this ?

Thanks in advance
Posted

You could use String.Split to break it into teh components:
C#
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
C#
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!
 
Share this answer
 
Hi,
Go through this-
substring [^]
C# Strings[^]
 
Share this answer
 
string a= "C:\TEMP\FDB2\27JUN2012.TEL136430D\NDDF PLUS DB\NDDF Plus DB"
string[] a = comment.Split('\');
msgbox.show(a[2]);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900