Looking to get the substring after the last comma or the last pipe. So say I have a string that could be either: "pipe|delimited|string" or "comma,delimited,string", the result should be "string" in both cases.
I'm looking at C#'s substring on a lastindexof, but I don't know how to do it for both pipes and commas. Something like this: str.Substring(str.LastIndexOf('|' or ',')). Any ideas?
There's a nice function for that.
str.LastIndexOfAny(new []{',','|'});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With