×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2011-02-27 08:11, David Gibbs wrote:
On 2/26/2011 5:29 PM, Pete Hall wrote:
Why does this work:
String[] fields = errRecord.replace("|", "\t").split("\t");
While this does not:
String[] fields = errRecord.split("|");
Isn't '|' a regex operator?
Have you tried escaping the |? ("\|")
david
Yeah, tried that. It throws an exception if I ignore the editor error:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\).
I've tried "\0x7c", "\u007C" and "\u7C00" too. The editor accepts those,
but they all return an array of String containing one element, which
includes all of the characters in the record, including the pipes. I
copied the pipe character from the variable window into V (hex viewer),
and it really is 0x7c. I even tried extracting the pipe from the record
with substring() and using the extracted delimiter in split(). It made
no difference.
An example errRecord looks like this:
1|20110226||||0|6068|6|33243.95|6062|35084323.55|0|0.00|0|0.00
I guess I'll just go with the two stage parse. Apparently split() has
some limitations.
- --
Pete Hall
pete@xxxxxxxxxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAk1qd1oACgkQXczQcKdXKg4SJwCgtUjD+TJMFYfWOMHrGSqyZWSL
DYIAnjRaEGMDHha7RcF3o5JnZpndORZ5
=Z6tI
-----END PGP SIGNATURE-----
As an Amazon Associate we earn from qualifying purchases.