Raw String Literal Library Support
Remi Forax
forax at univ-mlv.fr
Tue Mar 13 18:42:10 UTC 2018
Hi Jim,
----- Mail original -----
> De: "Jim Laskey" <james.laskey at oracle.com>
> À: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Mardi 13 Mars 2018 14:47:29
> Objet: Raw String Literal Library Support
> With the announcement of JEP 326 Raw String Literals, we would like to open up a
> discussion with regards to RSL library support. Below are several implemented
> String methods that are believed to be appropriate. Please comment on those
> mentioned below including recommending alternate names or signatures.
> Additional methods can be considered if warranted, but as always, the bar for
> inclusion in String is high.
>
> You should keep a couple things in mind when reviewing these methods.
>
> Methods should be applicable to all strings, not just Raw String Literals.
>
> The number of additional methods should be minimized, not adding every possible
> method.
>
> Don't put any emphasis on performance. That is a separate discussion.
>
> Cheers,
>
> -- Jim
>
> A. Line support.
>
> public Stream<String> lines()
> Returns a stream of substrings extracted from this string partitioned by line
> terminators. Internally, the stream is implemented using a Spliteratorthat
> extracts one line at a time. The line terminators recognized are \n, \r\n and
> \r. This method provides versatility for the developer working with multi-line
> strings.
it already exists :)
Stream<String> stream = Pattern.compile("\n|\r\n|\r").splitAsStream(string);
Rémi
More information about the core-libs-dev
mailing list