[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commit-cp] [bugs #11728] String.split() function return worng results f
From: |
anonymous |
Subject: |
[commit-cp] [bugs #11728] String.split() function return worng results for a String with TAB delimiters "t" |
Date: |
Tue, 25 Jan 2005 07:02:00 +0000 |
User-agent: |
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) |
URL:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=11728>
Summary: String.split() function return worng results for a
String with TAB delimiters "\t"
Project: classpath
Submitted by: None
Submitted on: Tue 01/25/2005 at 02:02
Category: classpath
Severity: 5 - Average
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Platform Version: Windows XP
_______________________________________________________
Details:
-----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\tB\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tC"
String[] s = row.split("\t");
String row1 = s.ToString();
// Value of row1 = "A\t\B\t\t\t\t\t\t\t\t\tC"
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 "\t" as the delimeter
row.split("\t") 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
_______________________________________________________
This item URL is:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=11728>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [commit-cp] [bugs #11728] String.split() function return worng results for a String with TAB delimiters "t",
anonymous <=