文法
IniFile.setComment( <section>, <key>, <comment>, [pos] )
IniFile.setComment( <key>, <comment>, [pos] )
類别
IniFile
描述
設定指定 item 的注釋。
參數
參數名 | 參數類型 | 預設值 | 描述 | 是否必填 |
---|---|---|---|---|
section | string | --- | 段名 | 是 |
key | string | --- | 鍵名 | 是 |
comment | string | --- | 設定的注釋 | 是 |
pos | boolean | true | true: 前置注釋; false: 後置注釋 | 否 |
傳回值
執行成功,無傳回值.
執行失敗,抛異常。
錯誤
如果出錯則抛異常,并輸出錯誤資訊,可以通過getLastErrMsg()擷取錯誤資訊或通過getLastError()擷取錯誤碼。
關于錯誤處理可以參考常見錯誤處理指南。
常見錯誤可參考錯誤碼。
示例
- 打開一個 INI 檔案。
Copy> var ini = new IniFile( "/opt/sequoiadb/file.ini", SDB_INIFILE_FLAGS_DEFAULT )
- 設定指定 item 的注釋。
> ini.setComment( "info", "name", "what's your name" )
相關内容:addLastComment