summaryrefslogtreecommitdiff
path: root/Source/Core/Common/StringUtil.cpp
AgeCommit message (Collapse)Author
2024-10-10Modernize `std::replace` with rangesmitaclaw
2024-10-10Modernize `std::transform` with rangesmitaclaw
In StringUtil.h, the lambdas wrapping `Common::ToLower(char)` and `Common::ToUpper(char)` were only necessary due to the function names being overloaded.
2024-10-10Modernize `std::count_if` with rangesmitaclaw
2024-09-26Merge pull request #13068 from mitaclaw/redundant-case-insensitiveJMC47
IniFile: Migrate `Common::CaseInsensitiveLess` to StringUtil
2024-09-22StringUtil: Remove `JoinStrings`mitaclaw
With 12 uses of `JoinStrings` in the codebase vs 36 uses of `fmt::join`, fmtlib's range adapter for string concatenation with delimiters is clearly the preferred option.
2024-09-21IniFile: Migrate `Common::CaseInsensitiveLess` to StringUtilmitaclaw
Migrating `Common::CaseInsensitiveLess` to StringUtil.h will hopefully discourage rolling one's own solution in the future for case-insensitive associative containers when this (quite robust!) solution already exists. `Common::CaseInsensitiveStringCompare::IsEqual` was removed in favor of using the `Common::CaseInsensitiveEquals` function. The `a.size() != b.size()` condition in `Common::CaseInsensitiveEquals` can be removed, since `std::ranges::equal` already checks this condition (confirmed in libc++).
2024-08-22Add support for libfmt-11Alfred Wingate
fmt::join was moved into fmt/ranges.h Signed-off-by: Alfred Wingate <parona@protonmail.com>
2024-05-03improve NetBSD-specific codeGuilherme Janczak
NetBSD doesn't put packages in /usr/local like /CMakeLists.txt thought. The `#ifdef __NetBSD__` around iconv was actually breaking compilation on NetBSD when using the system libiconv (there's also a GNU iconv package) A C program included from C++ source broke on NetBSD specifically, work around it. This doesn't fix compilation on NetBSD, which is currently broken, but is closer to correct.
2023-12-29Common/StringUtil: Use internal linkage for codepage conversion functions.Admiral H. Curtiss
2023-09-03IOS/KD: Implement NWC24_CHECK_MAIL_NOWSketch
2023-06-22Kill AsciiToHexget
Now superseded by Common::FromChars
2023-05-16StringUtil: Move CommandLineToUtf8Argv() into Common namespaceLioncash
2023-05-16StringUtil: Move GetEscapedHtml() into Common namespaceLioncash
2023-05-16StringUtil: Move IsPrintableCharacter() into Common namespaceLioncash
2023-04-25Fix build of iconv code on OpenBSDBrad Smith
2023-02-28Common: Add utility function for case-insensitive string comparison.Admiral H. Curtiss
2023-01-24StringUtil: Make StringUTF8CodePointCount take string_viewLioncash
There's nothing really about this that would need to constrain it to only std::string instances.
2023-01-24Common: Replace StringBeginsWith/StringEndsWith with std equivalentsLioncash
Obsoletes these functions in favor of the standard member functions added in C++20.
2023-01-10get rid of HAS_STD_FILESYSTEMShawn Hoffman
just use std::filesystem
2022-07-26Merge pull request #10876 from shuffle2/cpudetectAdmiral H. Curtiss
CPUDetect: improve win/arm64 support
2022-07-25CPUDetect: improve win/arm64 supportShawn Hoffman
read brand_string on macos/arm64 remove unused flags report family/model info instead of vendor name
2022-07-25StripSpaces: only strip spacesShawn Hoffman
StripWhitespace maintains old behavior
2022-06-05Common/StringUtil: Add convenience function for converting paths to use ↵Admiral H. Curtiss
forward slashes on Windows.
2022-04-12Common/StringUtil: Use simpler formatting for floats and doubles.Admiral H. Curtiss
2022-01-16Create Common::ToLower and Common::ToUpperPokechu22
2021-07-21StringUtil: Remove unused function BuildCompleteFilenameDentomologist
2021-07-05treewide: convert GPLv2+ license info to SPDX tagsPierre Bourdon
SPDX standardizes how source code conveys its copyright and licensing information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX tags are adopted in many large projects, including things like the Linux kernel.
2021-06-01Updater: Escape HTML characters in commit descriptionsDentomologist
2021-05-12InputCommon: fix serialization of control expression with line breaksFiloppi
The control expression editor allows line breaks, but the serialization was losing anything after the first line break (/r /n). Instead of opting to encode them and decode them on serialization (which I tried but was not safe, as it would lose /n written in the string by users), I opted to replace them with a space.
2020-12-15Add NetBSD supportDavid Carlier
2020-10-23Common: Migrate logging to fmtLioncash
Continues the migration of our code over to the fmt logger.
2020-09-21DolphinQt: Handle non-ASCII characters in Windows cmd argumentsJosJuice
CommandLineParse expects UTF-8 strings. (QApplication, on the other hand, seems to be designed so that you can pass in the char** argv untouched on Windows and get proper Unicode handling.)
2020-07-18Merge pull request #8905 from JosJuice/jni-encodingLC
Android: Use correct encoding when converting strings
2020-07-16NetPlay: Limit nickname lengthTechjar
Ridiculously long nicknames cause UI silliness, so 30 characters seems like a reasonable limit, as it's the same as the forum.
2020-07-08Android: Use correct encoding when converting stringsJosJuice
The functions with "UTF" in the name use "modified UTF-8" rather than the standard UTF-8 which Dolphin uses, at least according to Oracle's documentation, so it is incorrect for us to use them. This change fixes the problem by converting between UTF-8 and UTF-16 manually instead of letting JNI do it for us.
2020-07-08Common: Never convert from UCS-2 in WStringToUTF8JosJuice
Probably not something we would run into in practice since Windows uses a separate implementation, but let's do it for the sake of correctness.
2020-07-08Common: Rename UTF16ToUTF8JosJuice
This function does *not* always convert from UTF-16. It converts from UTF-16 on Windows and UTF-32 on other operating systems. Also renaming UTF8ToUTF16 for consistency, even though it technically doesn't have the same problem since it only was implemented on Windows.
2020-03-16StringUtil: Add PathToFileName functionJosJuice
2020-02-09Fix another implicit false-to-nullptr conversionmagiblot
2020-01-16StringUtil: Add IsPrintableCharacter and use itLéo Lam
Add a function that safely returns whether a character is printable i.e. whether 0x20 <= c <= 0x7e is true. This is done in several places in our codebase and it's easy to run into undefined behaviour if the C version defined in <cctype> is used instead of this one, since its behaviour is undefined if the character is not representable as an unsigned char. This fixes MemoryViewWidget.
2020-01-04StringUtil: Make TryParse of floats handle comma and dot decimal separators.Jordan Woyak
2019-12-29Use std::istringstream or std::ostringstream instead of std::stringstream ↵David Korth
where possible. This removes std::iostream from the inheritance chain, which reduces overhead slightly.
2019-08-15Fix implicit false-to-nullptr conversionsQuellaZhang
2019-07-23StringUtil: Comply with variable naming styleJosJuice
2019-07-23StringUtil: Use std::string_view moreJosJuice
2019-06-21Work around C++20 std::filesystem changes related to u8stringJosJuice
2019-06-14Common: Use fmt where applicableLioncash
Begins the transition to using fmt for string formatting where applicable. Given fmt supports formatting std::string instances out of the box, we can remove now-unnecessary calls to .c_str() and .data(). Note that this change does not touch the actual logging subsystem aside from converting the final StringFromFormat call in the process over to fmt::format. Given our logging system is heavily used throughout the entire codebase, and converting that over will be quite a large change by itself, this will be tackled near the end of the conversion process.
2019-02-13Use empty instead of sizeFilip Gawin
2018-11-22Fix spurious error logs for conversions of empty strings on Windows.Jordan Woyak
2018-06-03StringUtil: Remove ValueToString(std::string)Léo Lam
Doesn't make a lot of sense to have a function that gives the string representation for a string.