您可以使用String类的indexOf()
方法在字符串中搜索特定字母。此方法返回字符串中单词的位置索引(如果找到)。否则返回-1。
示例
public class Test { public static void main(String args[]) { String str = new String("hi welcome to Nhooo"); int index = str.indexOf('w'); System.out.println("Index of the letter w :: "+index); } }
输出结果
Index of the letter w :: 3
热门文章
- 动物疫苗可以去畜牧局批发吗现在多少钱(动物疫苗经营许可证在哪里办)
- 办宠物医院需要什么资质(宠物医院开办批准手续)
- 被猫抓了一下轻微破皮要***吗没出血有点痒(被猫抓了一下轻微破皮不***没事吧)
- Linux-SUID提权_在线工具Live2D
- 「2月18日」最高速度19M/S,2025年SSR/Clash/Shadowrocket/V2ray每天更新免费节点订阅链接
- 「1月9日」最高速度21.4M/S,2025年SSR/V2ray/Clash/Shadowrocket每天更新免费节点订阅链接
- 动物疫苗接种时间表图片高清(动物疫苗接种时间表图片高清大图)
- 动物医院好评模板100字怎么写的呀(动物医院美团好评)
- 成都宠物领养平台怎么样啊多少钱一个(成都宠物领养平台交流微信群)
- 「2月28日」最高速度22.2M/S,2025年Shadowrocket/Clash/V2ray/SSR每天更新免费节点订阅链接