That’s the way I see it Jean-Luc.
From: Jean-Luc Hainaut<mailto:jean-luc.hain...@unamur.be>
Sent: 27 February 2018 09:56
To: SQLite mailing list<mailto:sqlite-users@mailinglists.sqlite.org>
Subject: Re: [sqlite] Strange concatenation result
Let me suggest an interpretation that see
Let me suggest an interpretation that seems to comply with the current
implementation of "substr".
1. String X is stored in a (ficticious) infinite array, the cells of
which are indexed -*, ..., -2, -1, 0, 1, 2,.., +*.
2. String X is stored from cell 1 upward.
3. String 'abcd' is stored in c
Hello,
On 2018-02-27 08:46, Simon Slavin wrote:
What should substr('abcd',0,-2) return? 'cd' or just 'd'? Or maybe just an
empty string?
NULL
Why?
-- best regards
Cezary H. Noweta
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.o
There's nothing special about Y=0. The Y can be anywhere outwith the string.
e.g.
substr('abc', 6, -4) = 'bc'
substr('abc', -5, 3) = 'a'
All substr functions should work this way. I wrote a c++ function to emulate
it.
String substr(const String &Str, int Start, int Len)
{
if (Str==""
On 26/02/2018 12:19, Cezary H. Noweta wrote:
Hello,
On 2018-02-26 11:38, Hick Gunter wrote:
The substr(x,y,z) function is defined only for nonzero values of y.
SQlite can return whatever it feels like if you insist on providing
invalid input. With "being nice to the user" and "making a best
e
Hello,
On 2018-02-26 11:38, Hick Gunter wrote:
The substr(x,y,z) function is defined only for nonzero values of y. SQlite can return whatever it
feels like if you insist on providing invalid input. With "being nice to the user" and
"making a best effort to return sensible data even for nonsens
Hello,
It seems that Y=0 denotes a fictitious empty position before the first
one (Y=1).Is it the intended behaviour?
The documentation (https://www.sqlite.org/lang_corefunc.html#substr),
says nothing about this specific pattern.
Even if it not intended, it will be very handy in some circums
About the "substr(X,Y,Z)" function, I observe a strange behaviour when Y
= 0.
If I execute this script:
select 'abcd',substr('abcd',0,1),substr('abcd',1,1),substr('abcd',2,1);
select 'abcd',substr('abcd',0,2),substr('abcd',1,2),substr('abcd',2,2);
select 'abcd',substr('abcd',0,9),substr('abcd
On Mon, Feb 26, 2018 at 12:33:29AM -0500, Igor Tandetnik wrote:
> On 2/26/2018 12:23 AM, Gary Briggs wrote:
> >Evening
> >
> >I'm seeing a weird effect when concatenting things:
> >WITH q(tape,dp) AS (SELECT '04E', 1)
> > SELECT SUBSTR(tape,1,dp-1) || SUBSTR(tape,dp,1)+1 || SUBSTR(tape,dp+1) AS
On 2/26/2018 12:23 AM, Gary Briggs wrote:
Evening
I'm seeing a weird effect when concatenting things:
WITH q(tape,dp) AS (SELECT '04E', 1)
SELECT SUBSTR(tape,1,dp-1) || SUBSTR(tape,dp,1)+1 || SUBSTR(tape,dp+1) AS
expect_14E,
|| has higher precedence than +. Your expression is an arithmetic
Evening
I'm seeing a weird effect when concatenting things:
WITH q(tape,dp) AS (SELECT '04E', 1)
SELECT SUBSTR(tape,1,dp-1) || SUBSTR(tape,dp,1)+1 || SUBSTR(tape,dp+1) AS
expect_14E,
SUBSTR(tape,1,dp-1) AS segment_1,
SUBSTR(tape,dp,1)+1 AS segment_2,
SUBSTR(tape,dp+1)
11 matches
Mail list logo