[Issue 20184] String maxsplit
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 1 21:43:11 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20184
--- Comment #3 from Jon Degenhardt <jrdemail2000-dlang at yahoo.com> ---
(In reply to svnpenn from comment #2)
> (In reply to Jon Degenhardt from comment #1)
> Here is a result with Python:
>
> >>> 'one two three'.split(maxsplit = 1)
> ['one', 'two three']
>
> as you can see, it doesnt discard any part of the original input, instead it
> stops splitting after the specified amount, and puts the rest of the string
> as the final element.
Thanks for clarify what you are looking for. This is a useful refinement of the
original description, which is:
> D seems to have no way to limit the number of splits done on a string.
D does have a way to limit the number of splits, but as you point out, this
mechanism doesn't preserve the remainder of the string in the fashion available
in a number of other libraries.
--
More information about the Digitalmars-d-bugs
mailing list