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

Generate a string with specified separators #16

Open
php-coder opened this issue Dec 9, 2017 · 3 comments
Open

Generate a string with specified separators #16

php-coder opened this issue Dec 9, 2017 · 3 comments

Comments

@php-coder
Copy link

I need to generate a string that could consist from words. I'm trying the following:

length(10).with(oneOf(" ,")).english()

but sometimes it generates strings that start or end with space or comma. I'm looking to a way of avoiding it. Would it be possible to also specify a separator between words?

@ctapobep
Copy link
Member

ctapobep commented Dec 9, 2017

Sounds useful. Something like this: length(10).with(wordSeparators()).english()?

@php-coder
Copy link
Author

Yes. Could be even shorter: length(10).with(separator(" ,")).english()

@ctapobep
Copy link
Member

ctapobep commented Dec 9, 2017

Ok, I don't know if I implement this in the nearest future. So in the meantime if this is acceptable, you can try repeaters: repeat(length(10), NUMERIC).string(", ").times(4)

BTW, this separator() can also be implemented outside of the lib. You just need to implement a specific interface.

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