SQLite notes about the function of substr

 

The official reference documentation: SQLite Query Language: Core Functions  http://www.sqlite.org/lang_corefunc.html

Test SQL statement:

SELECT substr('2012-12-12 10:11:12 fff',0,20) AS substr_0_20,
substr('2012-12-12 10:11:12 fff',0,19) AS substr_0_19,
substr('2012-12-12 10:11:12 fff',1,19) AS substr_1_19,
substr('2012-12-12 10:11:12 fff',19) AS substr_19

Navicat on WINDOW, MesaSQLite on the Mac, SQLite statement on the test results on Android: substr_0_20 and substr_1_19 consistent results; substr_0_19 do not know why one would be less?

substr_0_20 substr_0_19 substr_1_19 substr_19
2012-12-12 10:11:12 2012-12-12 10:11:1 2012-12-12 10:11:12 2 fff

IOS on the FMDB test results: substr_0_20 do not know why would one more?

substr_0_20 substr_0_19 substr_1_19 substr_19
2012-12-12 10:11:12  2012-12-12 10:11:12 2012-12-12 10:11:12 2 fff

In the end what is it normal?

Reproduced in: https: //www.cnblogs.com/AsionTang/p/4397833.html

Guess you like

Origin blog.csdn.net/weixin_33937913/article/details/93270813