diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-08-20 03:07:15 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-08-20 03:07:15 +0200 |
commit | 09eb98c5306f8d9a17287aa5a7509e17d56f2ee0 (patch) | |
tree | cc42dbd2ed031932067565cc79ac651ddc276e0d /doc | |
parent | 4f640762f7ca0b6e2500b48a07eb1fe868166d9c (diff) |
Improve documentation for `String.get_extension()`
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/String.xml | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 467e2f901f..97efc24bd1 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -181,7 +181,17 @@ <method name="get_extension" qualifiers="const"> <return type="String" /> <description> - If the string is a valid file path, returns the extension. + Returns the extension without the leading period character ([code].[/code]) if the string is a valid file name or path. If the string does not contain an extension, returns an empty string instead. + [codeblock] + print("/path/to/file.txt".get_extension()) # "txt" + print("file.txt".get_extension()) # "txt" + print("file.sample.txt".get_extension()) # "txt" + print(".txt".get_extension()) # "txt" + print("file.txt.".get_extension()) # "" (empty string) + print("file.txt..".get_extension()) # "" (empty string) + print("txt".get_extension()) # "" (empty string) + print("".get_extension()) # "" (empty string) + [/codeblock] </description> </method> <method name="get_file" qualifiers="const"> |