Hi how can i read one line from string ??? i have string like this :
hello ; boy ; sun
welcome;google;pink
how can i read first line only ? thanks
Hi how can i read one line from string ??? i have string like this :
hello ; boy ; sun
welcome;google;pink
how can i read first line only ? thanks
String originalString="hello ; boy ; sun\nwelcome;google;pink";
String firstLine=originalString.substring(0,originalString.indexOf('\n'));
See this previous question, but I like this solution better:
final InputStreamReader r = new InputStreamReader( new ByteArrayReader( string.getBytes() ) );
be aware that some applications actually use \r\n instead of \n to indicate new lines