我需要从一个字符串数组中打印出字符串,该数组中特定字符的出现次数最多。
例子:
{"I","have","feelings"} , 'e'
打印“feelings”。
{"doodlidoo","foo","moon"} , 'o'
打印“doodlidoo”。
到目前为止,我已经想出了这个,它可以找到每个字符串的长度。我只需要弄清楚如何打印单个字符串。
public static String MostLettersInWord(String[] list, char c)
{
for (int x = 0; x < list.Length; x++)
{
int count = list[x].Split(c).Length - 1;
}
return list[0];
}
最佳答案
关于c# - 在字符串数组中打印出特定字符出现次数最多的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27876571/