当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


Ruby OutputMethod.parse_printf_format用法及代码示例

本文简要介绍ruby语言中 IRB::OutputMethod.parse_printf_format 的用法。

用法

parse_printf_format(format, opts)

如果在来自 printf 的给定 format 中存在成功的 Regexp 匹配,则返回给定 formatopts 的数组以供 Kernel#sprintf 使用

%
<flag>  [#0- +]
<minimum field width> (\*|\*[1-9][0-9]*\$|[1-9][0-9]*)
<precision>.(\*|\*[1-9][0-9]*\$|[1-9][0-9]*|)?
#<length modifier>(hh|h|l|ll|L|q|j|z|t)
<conversion specifier>[diouxXeEfgGcsb%]

相关用法


注:本文由纯净天空筛选整理自ruby-lang.org大神的英文原创作品 OutputMethod.parse_printf_format。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。