bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22849] String.split() function return worng results for a


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22849] String.split() function return worng results for a String with TAB delimiters " "
Date: 16 Oct 2005 01:27:27 -0000

-----Java Source Code- modified for repotting the bug--
-----Explanation below the sample code----------
String fullPath = "test.txt";
FileInputStream input = new FileInputStream(fullPath);
BufferedReader r = new BufferedReader(new 
InputStreamReader(input));
String row = r.readLine(); 
// Value of r = "A      B                                                      
                                                                        C"
String[] s = row.split("        "); 
String row1 = s.ToString(); 
// Value of row1 = "A   B                                                      
                C"
r.close();

-----------------------------------------
The input file test.txt is a tab delimited file.
In this example, it has values A,B,C with tabs in between 
them.

I read the row from the file and split the row passing 
the "   " as the delimeter

row.split("     ") return me an array of strings. It ignored 
some of the tabs and returned me fewer elements 
(around 10 elements) instead of 17.

-Amit 
cell # (650) 743 0931


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22849





reply via email to

[Prev in Thread] Current Thread [Next in Thread]