If it’s always going to be “NDC: [number]”, you can use a fairly simple Regular Expression.
var re = new System.Text.RegularExpressions.Regex(@"NDC\:\s(\d{11})");
var phrase = "Rx: RX15046522B Brand: LEVOTHYROXINE SODIUM Generic: LEVOTHYROXINE SODIUM NDC: 00378180001 Barcode: 0378180001 Strength: 25 mcg Form: Tablet Color: orange Marking: Shape: oblong";
if (re.IsMatch(phrase))
{
var match = re.Match(phrase);
// entire NDC string
context.Response.Write(match.Value);
// just the number
context.Response.Write(match.Groups[1].Value);
}
solved parse a string to look for a phrase in C# [closed]