-- Dustin Parker - Forward Slope, Inc. Cell: 619 277 2591
VGhlIDFzdCBydWxlIG9mIG9wdGltaXphdGlvbiBpcyAi ZG9uJ3Qgb3B0aW1pemUuIiBUaGUgMm5kIHJ1bGUgb2Yg b3B0aW1pemF0aW9uIGlzICJvcHRpbWl6ZSBsYXRlci4i On 2012-07-18 03:54, Mauricio Pazos wrote:
Oh my God!!! That is the explanation '-' is part of the metalanguage. Thanks On Tuesday, July 17, 2012 09:16:46 AM David Winslow wrote:Ah right, I didn't think about it but "-" is a special character inside of character classes in Java regular expressions. So "|-|" is parsed as a range from | to | (inclusive.) I guess when the - is the first character in the class the parser assumes it should be treated as an escape, but if you want to be explicit you can also escape it with a \. Backslashes also must be escaped in Java string literals so the end result would be .split("[+\\-Z]") -- David Winslow OpenGeo - http://opengeo.org/ On Tue, Jul 17, 2012 at 3:28 AM, Mauricio Pazos<[email protected]>wrote:On Monday, July 16, 2012 09:47:59 AM David Winslow wrote:String.split("[-|+|Z]")Actually, the square brackets denote a character class, so logical OR is the default behavior and | has no special meaning.will split on any of the characters '-' '+' '|' and 'Z' (note that thepipecharacter is included in this list! that's probably not intended.) See http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#ccThanks for clarification. The, bug here is related with the sequence in the character list. It looks like is not equal str = "aaaa-bbbb" str.split("[-|+|Z]") Not equal to str.split("[+|-|Z]") but str = "aaaa-bbbb" str.split("[-+Z]") equal to str.split("[+-Z]") cheers -- Mauricio Pazos
smime.p7s
Description: S/MIME Cryptographic Signature
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ GeoTools-Devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
