• [ Skill ] 中的通用输出格式规范


    https://www.cnblogs.com/yeungchie/

    Skill中的通用输出格式规范

    Common Output Format Specifications

    Format Specification Type(s) of Argument Prints Example
    %d fixnum 输出为十进制整数 printf("%d" 15)
    =>15
    %o fixnum 输出为八进制整数 printf("%o" 15)
    =>17
    %x fixnum 输出为十六进制整数 printf("%o" 15)
    =>f
    %f flonum 浮点数(默认6位小数) printf("%f" 10.0)
    =>10.000000

    printf("%0.3f" 10.0)
    =>10.000
    %e flonum 以科学计数输出浮点数 printf("%0.1e" 10.0)
    =>1.0e+01
    %g flonum 简化浮点数的输出 printf("%g" 10.0)
    =>10

    printf("%g" 10.10)
    =>10.1
    %s string, symbol 输出字符串或symbol类型(不带引号) printf("%s" "hellow,world")
    =>hellow,world
    %c string, symbol 输出字符串或symbol的第一个字节 printf("%c" "hellow,world")
    =>h
    %n fixnum, flonum 输出数字(浮点数默认6位小数) printf("%n" 10)
    =>10

    printf("%n" 10.0)
    =>10.000000
    %P list 输出Point格式 printf("%P" list(1 2))
    =>1:2
    %B list 输出Box格式 printf("%B" `((0 0) (1 1)))
    =>(0:0 1:1)
    %N any 按照原有类型输出(字符串会带引号) printf("%N" "hellow,world")
    =>"hellow,world"
    %L list 输出List格式 printf("%L" list(1 2 3))
    =>(1 2 3)
    %A any 匹配任意类型输出(字符串会带引号) printf("%A" "hellow,world")
    =>"hellow,world"
  • 相关阅读:
    HTML
    PHP正则表达式实例汇总
    PHP环境配置解释
    8.25study
    vue 封装手机验证登录组件
    vue 项目 vuetify 中 table item 按钮展示
    vue项目局部引入ant-design-vue库
    vue 组件Table组件鼠标显示效果
    vue 封装登录组件
    vue项目---编辑与新增页
  • 原文地址:https://www.cnblogs.com/yeungchie/p/12814482.html
Copyright © 2020-2023  润新知