• getComment()
    • 语法
    • 类别
    • 描述
    • 参数
    • 返回值
    • 错误
    • 示例

    getComment()

    语法

    IniFile.getComment( <section>, <key>, [pos] )

    IniFile.getComment( <key>, [pos] )

    类别

    IniFile

    描述

    获取指定 item 的注释。

    参数

    参数名参数类型默认值描述是否必填
    sectionstring—-段名
    keystring—-键名
    posbooleantruetrue: 前置注释; false: 后置注释

    返回值

    执行成功,返回注释.

    执行失败,抛异常。

    错误

    如果出错则抛异常,并输出错误信息,可以通过getLastErrMsg()获取错误信息或通过getLastError()获取错误码。关于错误处理可以参考常见错误处理指南。

    常见错误可参考错误码。

    示例

    • 打开一个 INI 文件。
    1. > var ini = new IniFile( "/opt/sequoiadb/file.ini", SDB_INIFILE_FLAGS_DEFAULT )
    • 获取指定 item 的注释。
    1. > ini.getComment( "info", "name" )
    2. what's your name