Aaaaah, so rtrim(X,Y) removes all characters in the Y slot; NOT the string Y.  
Apologies.  I thought that it was the string that it removed.  Ok, replace it 
is, then.


________________________________
From: sqlite-users <[email protected]> on behalf of 
Hick Gunter <[email protected]>
Sent: Thursday, February 20, 2020 11:09 AM
To: SQLite mailing list <[email protected]>
Subject: Re: [sqlite] [EXTERNAL] rtrim and round functions unexpected result

Round(1299.6) returns the floating point number 1300.0,
passing 1300.0 to the rtrim function converts it tot he string '1300.0'
removing all '.' and '0' characters from '1300.0' yields 13
This is no suprise

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[email protected]] Im 
Auftrag von Jose Isaias Cabrera
Gesendet: Donnerstag, 20. Februar 2020 17:03
An: SQLite mailing list <[email protected]>
Betreff: [EXTERNAL] [sqlite] rtrim and round functions unexpected result


Greetings.

Please take a look at the following:
sqlite> select rtrim(round(1235.6));
1236.0
This is expected.
sqlite> select rtrim(round(1235.6),'.0');
1236
Also expected.
sqlite> select rtrim(round(1299.6),'.0');
13
is not expected.  I was hoping for 1300.  Also, just rtrim,
sqlite> select rtrim('1000.0','.0');
1
sqlite> select rtrim('1000.0','0');
1000.

I know I can use replace for this,

sqlite> select replace('10000.0','.0','');
10000

but I wanted to see if there was an explanation for it. By the way, escaping 
the period (.) or dot also fails.

sqlite> select rtrim('1000.0','\.0');
1

Thanks.

josé
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to