我有一种方法可以根据字符串删除描述词,但我相信有更有效的方法可以做到这一点。
iMonster
可以像胖兽人流氓一样,我要去掉胖子。
private static string[] _adjectives = { "angry",
"big",
"fat",
"happy",
"large",
"nasty",
"fierce",
"thin",
"small",
"tall",
"short" };
private static string RemoveMonsterAdjective(string iMonster)
{
foreach (string adjective in _adjectives)
{
if (iMonster.Contains(adjective))
{
iMonster = iMonster.Replace(adjective, "").Trim();
break;
}
}
return iMonster;
}
希望有人可以帮助我。提前致谢。