Here is another old function I have from my C# 1 days, what would be a more elegant way to write it:
//method: gets the text in a string in front of a marker, if marker is not there, then return empty string
//example: GetTextAfterMarker("documents/jan/letter043.doc","/") returns "documents"
//example: GetTextAfterMarker("letter043.doc","/") returns ""
//rank:8
public static string GetTextAfterMarker(string line, string marker) {
string r = "";
int pos = line.IndexOf(marker);
if(pos != -1) {
r = line.Substring(pos+(marker.Length),line.Length-pos-(marker.Length));
} else {
r = "";
}
return r;
}