我正在尝试在StringBuilder()创建的字符串中搜索正则表达式,如下所示
public String config( String langage ) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader (dir_user+"/.prochic/"+langage));
//System.out.println(getAbsolutePath());
String line = null;
StringBuilder stringBuilder = new StringBuilder();
String ls = System.getProperty("line.separator");
try {
while( ( line = reader.readLine() ) != null ) {
stringBuilder.append( line );
stringBuilder.append( ls );
}
return stringBuilder.toString();
} finally {
reader.close();
}
};
然后
String text=config(langage);
但是,我不能做像
这样的事情System.out.println(text[5]);
如何访问(或打印)字符串的不同组件(字符)?