Skip to content

Commit

Permalink
Improve documentation for String.get_extension()
Browse files Browse the repository at this point in the history
  • Loading branch information
Calinou committed Aug 20, 2021
1 parent 4f64076 commit 09eb98c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion doc/classes/String.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 09eb98c

Please sign in to comment.