What I am trying to accomplish is finding the last number in a string and split by that value.
string packageSize = "4/8.75LB";
Above I have a string that I would like to split into a string array, and put those into two different columns in the database. The first part would be a decimal, and the last part would be a string or varchar.
I have this code below and it seems to be working. Just wondering if there is a better solution, or an answered question that I missed.
string value = Regex.Match(packageSize, @"(\d+)(?!.*\d)", RegexOptions.RightToLeft).ToString();
int lastIndex = packageSize.LastIndexOf(value) + value.Length;
string packageLoad = packageSize.Substring(0, lastIndex);
decimal loadDecimal = Convert.ToDecimal(packageLoad);
Thanks for any help!