mirror of
https://github.com/godotengine/godot-cpp.git
synced 2026-01-06 06:10:06 +03:00
Fix crash when calling String::split/split_floats
Was casting to the wrong object type. Also adds parse_ints function to String with the same logic
This commit is contained in:
@@ -8,6 +8,7 @@ namespace godot {
|
|||||||
class NodePath;
|
class NodePath;
|
||||||
class Variant;
|
class Variant;
|
||||||
class PoolByteArray;
|
class PoolByteArray;
|
||||||
|
class PoolIntArray;
|
||||||
class PoolRealArray;
|
class PoolRealArray;
|
||||||
class PoolStringArray;
|
class PoolStringArray;
|
||||||
class String;
|
class String;
|
||||||
@@ -120,6 +121,7 @@ public:
|
|||||||
String sha256_text() const;
|
String sha256_text() const;
|
||||||
float similarity(String text) const;
|
float similarity(String text) const;
|
||||||
PoolStringArray split(String divisor, bool allow_empty = true) const;
|
PoolStringArray split(String divisor, bool allow_empty = true) const;
|
||||||
|
PoolIntArray split_ints(String divisor, bool allow_empty = true) const;
|
||||||
PoolRealArray split_floats(String divisor, bool allow_empty = true) const;
|
PoolRealArray split_floats(String divisor, bool allow_empty = true) const;
|
||||||
String strip_edges(bool left = true, bool right = true) const;
|
String strip_edges(bool left = true, bool right = true) const;
|
||||||
String substr(int from, int len) const;
|
String substr(int from, int len) const;
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ bool String::begins_with_char_array(const char *p_char_array) const {
|
|||||||
PoolStringArray String::bigrams() const {
|
PoolStringArray String::bigrams() const {
|
||||||
godot_array arr = godot::api->godot_string_bigrams(&_godot_string);
|
godot_array arr = godot::api->godot_string_bigrams(&_godot_string);
|
||||||
|
|
||||||
return *(PoolStringArray *)&arr;
|
return *(Array *)&arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
String String::c_escape() const {
|
String String::c_escape() const {
|
||||||
@@ -479,13 +479,19 @@ float String::similarity(String text) const {
|
|||||||
PoolStringArray String::split(String divisor, bool allow_empty) const {
|
PoolStringArray String::split(String divisor, bool allow_empty) const {
|
||||||
godot_array arr = godot::api->godot_string_split(&_godot_string, &divisor._godot_string);
|
godot_array arr = godot::api->godot_string_split(&_godot_string, &divisor._godot_string);
|
||||||
|
|
||||||
return *(PoolStringArray *)&arr;
|
return *(Array *)&arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
PoolIntArray String::split_ints(String divisor, bool allow_empty) const {
|
||||||
|
godot_array arr = godot::api->godot_string_split_floats(&_godot_string, &divisor._godot_string);
|
||||||
|
|
||||||
|
return *(Array *)&arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PoolRealArray String::split_floats(String divisor, bool allow_empty) const {
|
PoolRealArray String::split_floats(String divisor, bool allow_empty) const {
|
||||||
godot_array arr = godot::api->godot_string_split_floats(&_godot_string, &divisor._godot_string);
|
godot_array arr = godot::api->godot_string_split_floats(&_godot_string, &divisor._godot_string);
|
||||||
|
|
||||||
return *(PoolRealArray *)&arr;
|
return *(Array *)&arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
String String::strip_edges(bool left, bool right) const {
|
String String::strip_edges(bool left, bool right) const {
|
||||||
|
|||||||
Reference in New Issue
Block a user