dominictarr / split

MIT License
347 stars 39 forks source link

Keep split characters? #11

Closed WORMSS closed 9 years ago

WORMSS commented 9 years ago

Is it possible to add a option to 'keep' the split parameter? In it's current state, it is not possible to know after going through split, if it was split on \n or \r\n. So not possible to return it back to it's current state.

So I thought if you could add an option that would split. I know this would most likely cause a performance decrease as it would require a change from the built in string split function to a possibly be a regex match with return brackets in a while loop.

I do not like the sound of this, so wondered if you guys had any other magic workaround for such an implementation?

dominictarr commented 9 years ago

yes, there is a way, but it wasn't documented, so I added it: https://github.com/dominictarr/split#keep-matched-splitter

WORMSS commented 9 years ago

Thank you.