Merge pull request #56369 from Rubonnek/expose-string-join

This commit is contained in:
Rémi Verschelde 2022-01-06 15:14:18 +01:00 committed by GitHub
commit 5fa1961ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -268,6 +268,7 @@ struct _VariantCall {
VCALL_LOCALMEM3R(String, split); VCALL_LOCALMEM3R(String, split);
VCALL_LOCALMEM3R(String, rsplit); VCALL_LOCALMEM3R(String, rsplit);
VCALL_LOCALMEM2R(String, split_floats); VCALL_LOCALMEM2R(String, split_floats);
VCALL_LOCALMEM1R(String, join);
VCALL_LOCALMEM0R(String, to_upper); VCALL_LOCALMEM0R(String, to_upper);
VCALL_LOCALMEM0R(String, to_lower); VCALL_LOCALMEM0R(String, to_lower);
VCALL_LOCALMEM1R(String, left); VCALL_LOCALMEM1R(String, left);
@ -1669,6 +1670,7 @@ void register_variant_methods() {
ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, split, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, split, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0));
ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, rsplit, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, rsplit, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0));
ADDFUNC2R(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "delimiter", BOOL, "allow_empty", varray(true)); ADDFUNC2R(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "delimiter", BOOL, "allow_empty", varray(true));
ADDFUNC1R(STRING, STRING, String, join, POOL_STRING_ARRAY, "parts", varray());
ADDFUNC0R(STRING, STRING, String, to_upper, varray()); ADDFUNC0R(STRING, STRING, String, to_upper, varray());
ADDFUNC0R(STRING, STRING, String, to_lower, varray()); ADDFUNC0R(STRING, STRING, String, to_lower, varray());

View File

@ -480,6 +480,17 @@
Returns [code]true[/code] if this string contains only a well-formatted IPv4 or IPv6 address. This method considers [url=https://en.wikipedia.org/wiki/Reserved_IP_addresses]reserved IP addresses[/url] such as [code]0.0.0.0[/code] as valid. Returns [code]true[/code] if this string contains only a well-formatted IPv4 or IPv6 address. This method considers [url=https://en.wikipedia.org/wiki/Reserved_IP_addresses]reserved IP addresses[/url] such as [code]0.0.0.0[/code] as valid.
</description> </description>
</method> </method>
<method name="join">
<return type="String" />
<argument index="0" name="parts" type="PoolStringArray" />
<description>
Return a [String] which is the concatenation of the [code]parts[/code]. The separator between elements is the string providing this method.
Example:
[codeblock]
print(", ".join(["One", "Two", "Three", "Four"]))
[/codeblock]
</description>
</method>
<method name="json_escape"> <method name="json_escape">
<return type="String" /> <return type="String" />
<description> <description>