private void GetDoubleAndTripleBondLocations(string line, out List <int> doubleBondLocations, out List <int> tripleBondLocations) { if ((line.EndsWith("yne")) && (line.Contains("en-"))) { doubleBondLocations = UtilStrings.FindSecondLastNumberGroup(line); tripleBondLocations = UtilStrings.FindLastNumberGroup(line); } else if (line.EndsWith("ene")) { doubleBondLocations = UtilStrings.FindLastNumberGroup(line); tripleBondLocations = new List <int>(); } else if (line.EndsWith("yne")) { doubleBondLocations = new List <int>(); tripleBondLocations = UtilStrings.FindLastNumberGroup(line); } else { doubleBondLocations = new List <int>(); tripleBondLocations = new List <int>(); } doubleBondLocations = doubleBondLocations.ConvertAll(l => l - 1); tripleBondLocations = tripleBondLocations.ConvertAll(l => l - 1); }
public void FindLastNumberGroupTest() { string compoundName = "2-methyl-3,5,7-nonatriyne"; List <int> numbers = UtilStrings.FindLastNumberGroup(compoundName); Assert.AreEqual(3, numbers[0]); Assert.AreEqual(5, numbers[1]); Assert.AreEqual(7, numbers[2]); }