String buf = ...; // buf stores the content of the file
String a= "wo";
if(buf.indexOf(a) != -1) { // found
int index = buf.indexOf(a)+a.length();
System.out.println(buf.substring(index,index+1));
}else
System.out.println("Can not find:"+a);
// 没有用编译器去调,大意如此)
String a= "wo";
if(buf.indexOf(a) != -1) { // found
int index = buf.indexOf(a)+a.length();
System.out.println(buf.substring(index,index+1));
}else
System.out.println("Can not find:"+a);
// 没有用编译器去调,大意如此)
解决方案 »
- 关于字符串的操作
- 关于线程锁定的问题,纠结了一晚上
- 如何实现当main()线程结束后,其他线程一起强制结束
- 有人用过“文件比较”功能的java开源项目吗?就象eclipse里compare with local history
- 奇怪的线程控制问题。。。
- 如何绘制自定义的component。急......................................................................
- 请大家推荐几款高效,免费的java编辑器
- 异常的处理!
- 在java中如何获取window中环境变量path的值!!!高分
- 请教一个问题 正在学JAVA
- 不可思议:Linux下如何获取本机ip地址?!
- 向高人求助 看一下以下程序的功能(最好帮我注释一下) 万分感谢 谢谢!
The Chinese character should be at index+2, Its length is 1.
That's why we use buf.substring(index,index+1);
this.startsWith(str, k)
is true. Parameters:
str - any string.
Returns:
if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned. Throws:
NullPointerException - if str is null.另外这个编码表你是用什么来做的?我觉得可以用哈希散列表。