Skip to content

Commit 7586a0e

Browse files
committed
Update SM Delimiter-Separated Values.md
1 parent 5d3b4dd commit 7586a0e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

SM Delimiter-Separated Values.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ FROM json_each('["' || replace('usr/share/man', '/', '", "') || '"]') AS terms;
2525
| 2 | share |
2626
| 3 | man |
2727

28-
This query will fail if the string contains quotation marks or backslashes (assuming these characters are not JSON escaped). Another potential issue involves leading and terminal separators. However, developing a universal string-splitting SQL script is impractical. Instead, the script functionality should match reasonable assumptions about the input format for a specific use case.
28+
This query will fail if the string contains quotation marks or backslashes (assuming these characters are not JSON escaped). Another potential issue involves leading and trailing separators. However, developing a universal string-splitting SQL script is impractical. Instead, the script functionality should match reasonable assumptions about the input format for a specific use case.
2929

3030
For instance, let's improve the script to
3131

3232
- split path-like variables (both Linux and Windows styles),
33-
- handle leading/terminal value separator,
33+
- handle leading/trailing value separator,
3434
- handle doubled value separators (such as ";;"),
35-
- normalize all paths by stripping leading/terminal path separators,
35+
- normalize all paths by stripping leading/trailing path separators,
3636
- convert any backslashes to slashes.
3737

3838
<a name="DSV-Query"></a>
@@ -69,7 +69,7 @@ Going from top to bottom:
6969
7070
- *params* acts as surrogate variables. *params* has one row, and it defines value and path separators. If this flexibility is excessive or unnecessary, adjust or remove this block. With the given definition, this query handles the Linux-style path variable, and the *params.sep* must be adjusted for Windows-style paths.
7171
- *string_data* defines the input data to be processed.
72-
- *clean_strings* performs input preprocessing. This code may clean leading/terminal/duplicate value separators and escape backslashes.
72+
- *clean_strings* performs input preprocessing. This code may clean leading/trailing/duplicate value separators and escape backslashes.
7373
- *json_strings* formats the preprocessed output of *clean_strings* as JSON arrays.
7474
- *raw_terms* splits the input (*json_each* unescapes backslashes automatically).
7575
- *term* performs postprocessing (in this case, it replaces backslashes with slashes).

0 commit comments

Comments
 (0)