Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to extrct the substring between two char
Posted
Comments
Herman<T>.Instance 14-Mar-12 8:58am    
what have you tried? some code to share?
V. 14-Mar-12 9:00am    
What is the exact problem and what did you try to fix it?

If you know in advance the positions of the two chars then you may use (strangely enough) the String.Substring[^].
On the other hand, if you don't know such positions then you need to first locate them (via, for instance the String.IndexOf[^] method).
Alternatively, you may use the Regex Class[^].
 
Share this answer
 
v2
There are several approaches to achieve that.

You can use an regular expression to extract that substring, or you can simply use Substring method.

Check this link for the Regex way:
The 30 Minute Regex Tutorial[^]

or this on how to use the substring method
http://msdn.microsoft.com/en-us/library/aka44szs.aspx[^].


Next time be more concrete on your question so we can suggest you a cleaner solution.


Cheers
 
Share this answer
 
v3
Comments
Mario Majčica 14-Mar-12 9:07am    
Hi digimanus, why did you updated my answer? What was wrong in it?

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