Presently my code is like this but I am wondering if there is a way that I could simplify it. What I am looking for is for one of the strings "JLPT N1","JLPT N2","JLPT N3","JLPT N4","JLPT N5" and then when I see one of these I will set the value of a phraseSources[seq].JishoJlpt
.
Note that only one of the above can appear at once.
if (nodes2[0].InnerText.Contains("JLPT N5"))
{
phraseSources[seq].JishoJlpt = "5";
}
if (nodes2[0].InnerText.Contains("JLPT N4"))
{
phraseSources[seq].JishoJlpt = "4";
}
if (nodes2[0].InnerText.Contains("JLPT N3"))
{
phraseSources[seq].JishoJlpt = "3";
}
if (nodes2[0].InnerText.Contains("JLPT N2"))
{
phraseSources[seq].JishoJlpt = "2";
}
if (nodes2[0].InnerText.Contains("JLPT N1"))
{
phraseSources[seq].JishoJlpt = "1";
}
Would appreciate if anyone can suggest how I can simplify this.