I have been programming for one year and I have done string manipulation many times but never understood how it actually works or what the best way of doing it.
Let’s say I have this string
String abc = "https://uu2020.devuueva.com/portal/mesddsa/usforeer/nance/tings/M3C102d4104/1007/tingjack/default.aspx";
I want to only this part
"https://uu2020.devuueva.com/portal/mesddsa/usforeer/nance/tings/M3C102d4104"
Characters/Names can change and are dynamic, however “/” isn’t. Can someone demonstrate the simplest and the best way of doing it.
One thing to bear in mind here, is that if you’re dealing with a Uri, you are better off using the
Uriclass to extract pieces of information than trying to string-mash a solution together.http://msdn.microsoft.com/en-us/library/system.uri.aspx
For example:
Gets the section you’re after. Live example: http://rextester.com/JRWKOG58567
EDIT
Having discovered some more requirement, and frameework limitation, you might be better string mashing this after all, but you can still leverage some functionality from the
Uriclass.Live example: http://rextester.com/HBK80648