How can experiment IDs be displayed with four-digit padding?

printf renders text from a format string. Integer width is a minimum display width and can be zero-padded.

SQLite example and interpretation

Seven displays as 0007 while 12345 keeps all five digits. Formatting a label does not constrain the stored number.

SELECT printf('%04d',7),printf('%04d',12345);

Result [["0007", "12345"]]

中文

实验目录中的编号怎样固定显示为四位?

printf 可按格式字符串生成文本。整数格式的宽度是最小宽度,可用零填充。

SQLite 示例与适用条件

编号 7 显示为 0007,编号 12345 保留五位。它适合显示,不会限制数据库中的数值范围。

SELECT printf('%04d',7),printf('%04d',12345);

结果 [["0007", "12345"]]

References / 参考来源

Keep reading / 继续阅读