Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating numeric strings of specified lengths #69

Open
ZmurLV opened this issue Jan 24, 2020 · 1 comment
Open

Creating numeric strings of specified lengths #69

ZmurLV opened this issue Jan 24, 2020 · 1 comment

Comments

@ZmurLV
Copy link

ZmurLV commented Jan 24, 2020

Needed to create strings like this:
"ISO0260000590230322000012A800001"
that is a constant "ISO" + 22 numeric characters + A + 6 numeric characters.
Could not generate a numeric string of fixed length, because strings().numeric() doesn't seem to allow to set the length of a result.

@hyperpape
Copy link
Contributor

hyperpape commented May 18, 2020

It's possible to achieve this result.

new StringsDSL().betweenCodePoints((int) '0', (int)'9').ofLengthBetween(22, 22); 

or

new StringsDSL().betweenCodePoints(48, 57).ofLengthBetween(22, 22); 

depending on personal preferences.

A dedicated API for this might also be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants