mirror of
https://github.com/godotengine/godot.git
synced 2025-10-24 18:33:36 +00:00
Improve usage of String.split() vs get_slice()
This commit is contained in:
parent
2753d333f6
commit
d61a337a70
17 changed files with 45 additions and 50 deletions
|
|
@ -210,7 +210,7 @@ String OS_LinuxBSD::get_processor_name() const {
|
|||
while (!f->eof_reached()) {
|
||||
const String line = f->get_line();
|
||||
if (line.to_lower().contains("model name")) {
|
||||
return line.split(":")[1].strip_edges();
|
||||
return line.get_slicec(':', 1).strip_edges();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -295,7 +295,7 @@ String OS_LinuxBSD::get_systemd_os_release_info_value(const String &key) const {
|
|||
while (!f->eof_reached()) {
|
||||
const String line = f->get_line();
|
||||
if (line.contains(key)) {
|
||||
String value = line.split("=")[1].strip_edges();
|
||||
String value = line.get_slicec('=', 1).strip_edges();
|
||||
value = value.trim_prefix("\"");
|
||||
return value.trim_suffix("\"");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue