Hello,
My understanding of String.split() and "\t" and "\n" seems to be
incomplete. (I come from a DOS, Win, and VB enviornment.) I am in the
habit of using Tab delimited 'records' in a text file where the
records are delimited by CRLF. VB uses constants like vbTab and vbCrLf
to refer to tabs and line feeds. And the Linux, Android enviornment
utilizes \t and \n for the same things.
The following code yields (I think) different responses depending on
the source of strResponse. If strResponse originates in my Android
Java code (as a paramater constructed in the code), the following code
works just fine. But if strResponse is parsed from html document
created by me using PHP on the server, then the two Log.d's produce
exactly the same thing, the record which contains several "\t".
// Start Code *****************
String strRecords[] = strResponse.split("\n");
String strFields[];
Integer i;
for (i = 0; i < strRecords.length; i++){
strFields = strRecords[i].split("\t");
Log.d("NQ109", TAG + " in addTaps strRecords[i] = " + strRecords[i]);
Log.d("NQ109", TAG + " in addTaps strFields[0] = " + strFields[0]);
}
// End Code *****************
I also tried to utilize "|", the pipe symbol, chr(124), but that just
seems to split the record into an array of individual characters.
What is the error in my understanding of the split() method?
http://developer.android.com/reference/java/lang/String.html#split(java.lang.String)
does not seem to go deep enough for me to figure it out.
Thanks, John Brown
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en