我的数据在excel中看起来像这样:
if(soundCount > 0)
{
string[] smth;
string pattern = @"\(((?:[^()]|(?R))+)\)";
Regex match = new Regex(pattern, RegexOptions.None);
MatchCollection matches = match.Matches(sound);
smth = new string[matches.Count];
int i=0;
foreach (Match ma in matches)
{
smth[i] = Regex.Replace(ma.Value.Trim('(', ')'), @"\s+", "");
Console.WriteLine(smth[i]);
i++;
}
IList<sound_chips> newSoundchip = new List<sound_chips>();
foreach(string s in smth)
{
newSoundchip.Add(new sound_chips()
{
name = s.Split(',')[0].ToString(),
manufacturer_id = Convert.ToInt32(setManufacturer(s.Split(',')[1].ToString())),
motherboards = newMotherboard
});
}
insert.sound_chips.AddRange(newSoundchip);
}
它下降了数百行,而我知道如何删除重复项,是否有一种方法可以在excel或r中区分重复项?
我的决赛桌理想情况下会是这样的
Name Value
A 10
B 20
A 30
C 40
E 50
D 60
E 70
F 80
A 90
B 100