However, converting the medication name ToLower was too simplistic, since certain capitals needed to be preserved:
abobotulinumtoxinA
alteplase, tPA
aspirin, ASA
avian influenza A (H5N1) virus vaccine
Here is the code I used:
private string ConvertStringToLC(string name)
{
foreach (Match m in Regex.Matches(name, @"[A-Z]{1}[a-z]+"))
{
name = name.Substring(0, m.Index ) + char.ToLower(name[m.Index]) + name.Substring(m.Index + 1);
}
return name;
}
Because I was updating a sql database column I also had to take care of strings that had an apostrophe in them, such as burow's solution.
drugNameNew = drugNameNew.Replace("'", "''");
One last thing. If the generic drug name is used at the start of sentence it needs to be capitalized.
drugNameGeneric = char.ToUpper(drugNameGeneric[0]) + drugNameGeneri.Substring(1);