【发布时间】:2015-11-28 21:34:35
【问题描述】:
public static int letterPosition(String word,char a)//returns the position of searched character
{
int lenght=word.length();
for (int i=0; i < lenght; i++)
{
if(word.charAt(i)==a)
{
return i;
}
}
}
【问题讨论】:
-
它不处理从未找到字符的情况。
-
下面有三个答案,这些都有用吗?请考虑接受其中一个作为答案,如果是,请单击最有用的选项旁边的勾号。