mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-11-15 10:40:39 +01:00
StringUtil: Replace StartsWith/EndsWith with C++20 equivalents
This commit is contained in:
1 parent
d73d698fd5
commit
76f36b780c
14 files changed
+72
-83
No files matched your search
@@ -233,11 +233,11 @@ std::optional<InputBindingKey> InputManager::ParseInputBindingKey(const std::str
|
||||
return std::nullopt;
|
||||
|
||||
// lameee, string matching
|
||||
if (StringUtil::StartsWith(source, "Keyboard"))
|
||||
if (source.starts_with("Keyboard"))
|
||||
{
|
||||
return ParseHostKeyboardKey(source, sub_binding);
|
||||
}
|
||||
else if (StringUtil::StartsWith(source, "Pointer"))
|
||||
else if (source.starts_with("Pointer"))
|
||||
{
|
||||
return ParsePointerKey(source, sub_binding);
|
||||
}
|
||||
@@ -411,7 +411,7 @@ void InputManager::PrettifyInputBindingPart(const std::string_view binding, Smal
|
||||
return;
|
||||
|
||||
// lameee, string matching
|
||||
if (StringUtil::StartsWith(source, "Keyboard"))
|
||||
if (source.starts_with("Keyboard"))
|
||||
{
|
||||
std::optional<InputBindingKey> key = ParseHostKeyboardKey(source, sub_binding);
|
||||
const char* icon = key.has_value() ? ConvertHostKeyboardCodeToIcon(key->data) : nullptr;
|
||||
@@ -422,7 +422,7 @@ void InputManager::PrettifyInputBindingPart(const std::string_view binding, Smal
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (StringUtil::StartsWith(source, "Pointer"))
|
||||
else if (source.starts_with("Pointer"))
|
||||
{
|
||||
const std::optional<InputBindingKey> key = ParsePointerKey(source, sub_binding);
|
||||
if (key.has_value())
|
||||
@@ -633,7 +633,7 @@ std::optional<InputBindingKey> InputManager::ParsePointerKey(const std::string_v
|
||||
key.source_type = InputSourceType::Pointer;
|
||||
key.source_index = static_cast<u32>(pointer_index.value());
|
||||
|
||||
if (StringUtil::StartsWith(sub_binding, "Button"))
|
||||
if (sub_binding.starts_with("Button"))
|
||||
{
|
||||
const std::optional<s32> button_number = StringUtil::FromChars<s32>(sub_binding.substr(6));
|
||||
if (!button_number.has_value() || button_number.value() < 0)
|
||||
@@ -646,7 +646,7 @@ std::optional<InputBindingKey> InputManager::ParsePointerKey(const std::string_v
|
||||
|
||||
for (u32 i = 0; i < s_pointer_axis_names.size(); i++)
|
||||
{
|
||||
if (StringUtil::StartsWith(sub_binding, s_pointer_axis_names[i]))
|
||||
if (sub_binding.starts_with(s_pointer_axis_names[i]))
|
||||
{
|
||||
key.source_subtype = InputSubclass::PointerAxis;
|
||||
key.data = i;
|
||||
@@ -678,7 +678,7 @@ std::optional<InputBindingKey> InputManager::ParsePointerKey(const std::string_v
|
||||
|
||||
std::optional<u32> InputManager::GetIndexFromPointerBinding(const std::string_view& source)
|
||||
{
|
||||
if (!StringUtil::StartsWith(source, "Pointer-"))
|
||||
if (!source.starts_with("Pointer-"))
|
||||
return std::nullopt;
|
||||
|
||||
const std::optional<s32> pointer_index = StringUtil::FromChars<s32>(source.substr(8));
|
||||
|
||||
Reference in new issue
Block a user