Obviously it's ugly to use concatenation and char() to format a string
literal with tabs and newlines.
Is there a better way? Why doesn't printf() support newlines and tabs like
it's C cousin? --DD

PS: Built-in printf() also doesn't support positional params, to "emulate"
newline with printf( '%1$s1: %2$s%1$s2: %3$s%1$s' , char(10), 'one',
'two'), but that's not too readable either, in any case

sqlite> select printf('\n1: %s\n2: %s\n', 'one', 'two');
\n1: one\n2: two\n
sqlite> select char(10)||printf('1: %s', 'one')||char(10)||printf('2: %s',
'two')||char(10);

1: one
2: two

sqlite> select printf('\t1: %s\t2: %s\t', 'one', 'two');
\t1: one\t2: two\t
sqlite> select char(9)||printf('1: %s', 'one')||char(9)||printf('2: %s',
'two')||char(9);
        1: one  2: two
sqlite>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to