Split string value in C#
.net, c#, split
Solution
Use:
string s = "REF_SPHCPHJ0000057_Cancel Payer_20100105174151.pdf";
string middleBit = s.Split('_')[2];
Console.WriteLine(middleBit);
The output is
Cancel Payer
Problem
I have a string value which I need to get the middle bit out of, e.g. "Cancel Payer" / "New Paperless". These are examples of the string format: "REF_SPHCPHJ0000057_Cancel Payer_20100105174151.pdf" "REF_SPHCPHJ0000056_New Paperless_20100105174151.pdf"