PRINTF
デスクリプション
指定された printf 文字列と引数を使用して、フォーマットされた文字列を返します。
ヒント
この関数はバージョン3.0.6以降でサポートされています。
Syntax
PRINTF(<format>, [<args>, ...])
パラメータ
| パラメータ | 説明 |
|---|---|
<format> | printf形式の文字列。 |
<args> | フォーマットされる引数。 |
戻り値
printfモードを使用してフォーマットされた文字列。
例
select printf("hello world");
+-----------------------+
| printf("hello world") |
+-----------------------+
| hello world |
+-----------------------+
select printf('%d-%s-%.2f', 100, 'test', 3.14);
+-----------------------------------------+
| printf('%d-%s-%.2f', 100, 'test', 3.14) |
+-----------------------------------------+
| 100-test-3.14 |
+-----------------------------------------+
select printf('Int: %d, Str: %s, Float: %.2f, Hex: %x', 255, 'test', 3.14159, 255);
+-----------------------------------------------------------------------------+
| printf('Int: %d, Str: %s, Float: %.2f, Hex: %x', 255, 'test', 3.14159, 255) |
+-----------------------------------------------------------------------------+
| Int: 255, Str: test, Float: 3.14, Hex: ff |
+-----------------------------------------------------------------------------+