Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
20
Task/Substring/DuckDB/substring.duckdb
Normal file
20
Task/Substring/DuckDB/substring.duckdb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# For brevity, we will use a table-valued function for defining the sample string(s):
|
||||
create or replace function s() as table (select '一二三四五六七八九十' as s);
|
||||
|
||||
# starting from n characters in and of m length: s[n: n+m-1]
|
||||
select s[1:2] from s();
|
||||
|
||||
# starting from n characters in, up to the end of the string: s[n:]
|
||||
select s[9:] from s();
|
||||
|
||||
# whole string minus the last character: .[:-2]
|
||||
select s[0:-2] from s();
|
||||
|
||||
# starting from a known character within the string and of m length, say 2:
|
||||
select s[ix:ix+(2-1)] from (select s, position('五' in s) as ix from s());
|
||||
|
||||
# starting from a known substring within the string and of m length, say 2:
|
||||
select s[ix:ix+(2-1)] from (select s, position('五六' in s) as ix from s());
|
||||
|
||||
# For clarity we'll use DuckDB's 'list' output mode:
|
||||
.mode list
|
||||
Loading…
Add table
Add a link
Reference in a new issue