diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-09-25 10:53:37 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-09-27 15:50:43 +0200 |
commit | 4d74a89cfcdce4d9207f51c786a2a1fc278c5a11 (patch) | |
tree | 57dad8d63de8a0bf1b5f5e6e13d57982da431601 /doc/it | |
parent | be6a29a596b5da3be4c00943cd5bdceabd5159c5 (diff) | |
download | weechat-4d74a89cfcdce4d9207f51c786a2a1fc278c5a11.zip |
api: add function string_parse_size
Diffstat (limited to 'doc/it')
-rw-r--r-- | doc/it/weechat_plugin_api.it.adoc | 46 | ||||
-rw-r--r-- | doc/it/weechat_scripting.it.adoc | 1 |
2 files changed, 47 insertions, 0 deletions
diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index 5c1ff0685..e3f94f74e 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -2044,6 +2044,52 @@ def string_format_size(size: int) -> str: ... str = weechat.string_format_size(15200) # == "15.2 KB" ---- +// TRANSLATION MISSING +==== string_parse_size + +_WeeChat ≥ 3.7._ + +Parse a string with a size and optional unit and return the size in bytes. + +Prototipo: + +[source,c] +---- +unsigned long long weechat_string_parse_size (const char *size); +---- + +Argomenti: + +* _size_: the size as string: float number followed optional spaces and optional + unit (lower or upper case), which is one of: +** _b_: bytes +** _k_: kilobytes (1k = 1000 bytes) +** _m_: megabytes (1m = 1000k = 1,000,000 bytes) +** _g_: gigabytes (1g = 1000m = 1,000,000,000 bytes) +** _t_: terabytes (1t = 1000g = 1,000,000,000,000 bytes) + +Valore restituito: + +* size in bytes, 0 if error + +Esempio in C: + +[source,c] +---- +unsigned long long size = weechat_parse_size ("1.34m"); /* size == 1340000 */ +---- + +Script (Python): + +[source,python] +---- +# prototipo +def string_parse_size(size: str) -> int: ... + +# esempio +size = weechat.string_parse_size("1.34m") # 1340000 +---- + ==== string_color_code_size _WeeChat ≥ 3.0._ diff --git a/doc/it/weechat_scripting.it.adoc b/doc/it/weechat_scripting.it.adoc index ac6fd28f0..44bed235c 100644 --- a/doc/it/weechat_scripting.it.adoc +++ b/doc/it/weechat_scripting.it.adoc @@ -603,6 +603,7 @@ Elenco di funzioni nelle API per gli script: string_has_highlight_regex + string_mask_to_regex + string_format_size + + string_parse_size + string_color_code_size + string_remove_color + string_is_command_char + |