Reputation: 117
I am trying to search for regular expressions in a string created by StringBuilder() as follows
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();
}
};
and then
String text=config(langage);
However, I can't do something like
System.out.println(text[5]);
How can I access (or print) the different components (characters) of my string?
Upvotes: 0
Views: 83