commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pascal Schumacher (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (TEXT-93) RandomStringGenerator accepts a list of valid characters
Date Thu, 22 Jun 2017 18:46:00 GMT

    [ https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059728#comment-16059728
] 

Pascal Schumacher edited comment on TEXT-93 at 6/22/17 6:45 PM:
----------------------------------------------------------------

Thanks for the suggestion.

There is a bit of overlap with RandomStringGenerator#filteredBy.

With some work you can already archive this today, e.g.

{code}
Set<Integer> characters = Stream.of('a', 'b', '0').map(i -> (int) i).collect(Collectors.toSet());
String str = new RandomStringGenerator.Builder().filteredBy(i -> characters.contains(i)).build().generate(5);{code}


was (Author: pascalschumacher):
Thanks for the suggestion.

There is a bit of overlap with RandomStringGenerator#filteredBy.

With some work you can already archive this today, e.g.

{code}
Set<Integer> characters = Stream.of('a', 'b', 'c').map(i -> (int) i).collect(Collectors.toSet());
String str = new RandomStringGenerator.Builder().filteredBy(i -> characters.contains(i)).build().generate(5);{code}

> RandomStringGenerator accepts a list of valid characters
> --------------------------------------------------------
>
>                 Key: TEXT-93
>                 URL: https://issues.apache.org/jira/browse/TEXT-93
>             Project: Commons Text
>          Issue Type: Wish
>            Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
>     .selectFrom(charArray)
>     .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message