-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Martin,

On 5/8/19 13:58, Martin Grigorov wrote:
> Hi,
> 
> On Wed, May 8, 2019 at 7:16 PM Christopher Schultz < 
> ch...@christopherschultz.net> wrote:
> 
> All,
> 
> While working on the sort-file-listing enhancement over the
> weekend, I looked in the Tomcat code to see if we already had a
> method to split a string by a single character. The closest method
> I found was
> 
> 
>> Since few years java.lang.String#split(String) is optimized to
>> not use Regex when the following condition passes:
> 
>> if (((regex.value.length == 1 && ".$|()[{^?*+\\".indexOf(ch =
>> regex.charAt(0)) == -1) || (regex.length() == 2 && 
>> regex.charAt(0) == '\\' && (((ch =
>> regex.charAt(1))-'0')|('9'-ch)) < 0 && ((ch-'a')|('z'-ch)) < 0
>> && ((ch-'A')|('Z'-ch)) < 0)) && (ch <
>> Character.MIN_HIGH_SURROGATE || ch >
>> Character.MAX_LOW_SURROGATE)) {
> 
>> i.e. in many cases it is already fast enough.

This is a great point. My method removes "empty" items and trims
stuff, but it does not really have to ; it just does because it was
easy enough to add at the time.

I'm happy to remove my custom split() method and use String.split in
my case.

I'll check to see if JspUtil.split() can be used in this way as well
and we can remove it.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzTKfQACgkQHPApP6U8
pFh+9g//SXxOvwH5IAtfBUdq8nDOnkjB06j0HY8cefEnGS4W1KBVJBihtHpTI0IV
vN5Z5yqAslV7kbcc+/0ezV5g8JdToOhD2K+xn2ulT9o5gjX8MiI267luVvoaYbGM
hG/1tWPDft/IMLV5XkO6Cpr/1Bot0dBcEX9ASMb3tDKnhorOCmb9u+Oq2Fu4lZZ8
VSaPZItWc/9C7wQ5Uw3gj5WIeSThcG6i0o5HFEB3NqJiMi2LOwScz7Dk2YZkdIch
BuhsSdN97VuNO40TNLy71YLEPygHF3X3u1PtuKxjXLR4VhWBounGVzLlDvm/VJcz
C4cfzaNLFyBddDq/Kg4aBLXCqM7JXRjjb2QJ4VoXilpdM8fV9fDduozfbEUgdi1U
tSnCehHqwoD/UcqEWRBL0Scodm4KAXDTIFn4DVU+nzAAUIkGyJh60PadvCwJgA9H
bKTQOuv+yGaiZ9QjegGb+r2xcqDTmOXWBFgyUXMegQJTBUb9czgZ6z81pgt+ruNq
HpJChdsK1JCC8DIfkiDHMNohU3hH323DFtuC4PFbvF225l5ywu6pyg4qjaBEfw6X
W8Mf+KwfHcQUvjXhNPqKex4PU7HnolNL8h2Jigd3C97PtUMUiD4A+zekQ7oRiibe
3HFqnDA8oiNRCB5pkG3eTyXjii61bUMEglEsYxUoCZVR74Ek+0A=
=xZct
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to