Improve documentation for `String.get_extension()`
This commit is contained in:
parent
4f640762f7
commit
09eb98c530
|
@ -181,7 +181,17 @@
|
||||||
<method name="get_extension" qualifiers="const">
|
<method name="get_extension" qualifiers="const">
|
||||||
<return type="String" />
|
<return type="String" />
|
||||||
<description>
|
<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>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_file" qualifiers="const">
|
<method name="get_file" qualifiers="const">
|
||||||
|
|
Loading…
Reference in New Issue