Split Strings and Keep the Delimiter
source link: https://pineco.de/snippets/split-strings-and-keep-the-delimiter/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
We use cookies for commenting and analytics. For more details, please visit our privacy page.
Splitting strings by a separator is a daily job for a developer. Usually, we don’t want to keep the delimiter, only the strings that have been glued by it. But still, there are some cases, when we want to keep them when splitting the string.
'one.two.three'.split(/(?<=\.)/); // ['one.', 'two.', 'three'] 'one.two.three'.split(/(?=\.)/); // ['one', '.two', '.three']
You can see, we even have control, where to put the delimiter.
Recommend
-
57
README.md Syntactic Close
-
5
Changing the MySQL query delimiter via the C API advertisements How can I change the MySQL query delimiter using the C API? I tried sending
-
11
SQL * Loader: Process the delimiter characters in the data advertisements I am loading some data to Oracle via SQLLDR. The source file is "pip...
-
2
Split strings the right way – or the next best way UPDATE: September 2nd, 2021 (Originally published July 26th, 2012.) A lot of things change over the course of a few majo...
-
1
How to Split Excel Cells Using a Delimiter By Hirangi Pandya Published 14 hours ago The first step in working with data in Exce...
-
6
SQL: Return the first integer after a delimiter advertisements My SQL database manages the metadata for a front end applica...
-
3
Delimiter-separated values From Wikipedia, the free encyclopedia Jump to navigation
-
2
Every year, I write a special article for Halloween in which I show a SAS programming TRICK that is a real TREAT! This year, the trick is to concatenate two strings into a single string in a way that guarantees you can always recover the original...
-
4
How to split JavaScript strings into sentences, words or graphemes with "Intl.Segmenter"This post is part of my Today I learned series in which I shar...
-
5
Deco - Delimiter Collision Free Format Deco is a human readable text format which avoids the delimiter collision problem. Deco has minimal an...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK