源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Lua之字符串格式化例子和常用格式化参数介绍

  • 时间:2022-06-01 16:13 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Lua之字符串格式化例子和常用格式化参数介绍
[u]复制代码[/u] 代码如下:
a = 'aadsdf\"'  print(string.format("%q",a)) 
%d 十进制整数 %o 八进制整数 %x 十六进制整数,大写的话为 %X %f 浮点型 格式 [-]nnnn.nnnn %e 科学表示法 格式 [-]n.nnnn e [+|-]nnn, 大写的话为 %E %g floating-point as %e if exp. < -4 or >= precision, else as %f ; uppercase if %G . %c character having the (system-dependent) code passed as integer %s 没有\0的字符串 %q 双引号间的string, with all special characters escaped %% ' % ' 字符 %a 字母 %c控制字符 %d多个数字 %l 小写字母 %p标点符号 %s空白字符 %x十六进制 %z内部表示为0的字符
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部