Linus Groh
4fafe14691
AK: Add String{,Utils}::to_snakecase()
...
This is an improved version of WrapperGenerator's snake_name(), which
seems like the kind of thing that could be useful elsewhere but would
end up getting duplicated - so let's add this to AK::String instead,
like to_{lowercase,uppercase}().
2021-02-21 19:47:47 +01:00
AnotherTest
39442e6d4f
AK: Add String{View,}::find(StringView)
...
I personally mistook `find_first_of(StringView)` to be analogous to this
so let's add a `find()` method that actually searches the string.
2021-01-12 23:36:20 +01:00
AnotherTest
f3ecea1fb3
AK: Add String{,View}::is_whitespace()
...
+Tests!
2021-01-03 10:47:29 +01:00
AnotherTest
cbe0a8b403
AK: Allow trailing '*'s in a glob pattern to match nothing
...
Fixes part of #4607 .
2020-12-29 02:35:52 +01:00
Sahan Fernando
1a12f964d4
AK: Test StringUtils::convert_to_int for different types
2020-12-21 00:15:44 +01:00
Linus Groh
d6a4c0c79e
AK: Trim whitespace in StringUtils::convert_to_{int,uint,uint_from_hex}()
...
Personally I found this unintuitive at first, but it is in line with
strtol(), Python's int() or JavaScript's parseInt(), so I guess it makes
sense.
Fixes #4097 .
2020-11-17 09:48:35 +01:00
Linus Groh
d3ee3fc68a
AK: Fix StringUtils::contains() case insensitive search
...
It would incorrectly return false if needle was at the end the string.
2020-11-14 10:11:26 +01:00
AnotherTest
0801b1fada
AK: Make String::matches() capable of reporting match positions too
...
Also, rewrite StringUtils::match(), because the old implementation was
fairly broken, e.g. "acdcxb" would *not* match "a*?b".
2020-10-29 11:53:01 +01:00
Tom
25e7225782
AK: Enhance String::contains to allow case-insensitive searches
2020-10-22 15:23:45 +02:00
Ben Wiederhake
8940bc3503
Meta+AK: Make clang-format-10 clean
2020-09-25 21:18:17 +02:00
Brian Gianforcaro
125eab998f
AK: Fix StringUtils tests to actually observe return value.
...
Noticed this while playing around with making Optional<T>
nodiscard.
2020-08-05 12:18:54 +02:00
Luke
a5ecb9bd6b
AK: Add case insensitive version of starts_with
2020-07-21 01:08:32 +02:00
Andreas Kling
fdfda6dec2
AK: Make string-to-number conversion helpers return Optional
...
Get rid of the weird old signature:
- int StringType::to_int(bool& ok) const
And replace it with sensible new signature:
- Optional<int> StringType::to_int() const
2020-06-12 21:28:55 +02:00
Brian Gianforcaro
e5045b62b8
AK: Expand string tests to include ends_with case insensitivity
2020-05-26 13:17:19 +02:00
Linus Groh
5bac08c969
AK: Add missing copyright header to TestStringUtils.cpp
2020-05-09 23:45:16 +02:00
Emanuel Sprung
c7568943d9
AK: Make tests compilable with the serenity target toolchain
2020-05-06 19:07:22 +02:00
Andreas Kling
b866582d98
AK: Fix all the warnings in the AK tests
2020-03-06 11:22:23 +01:00
howar6hill
d75fa80a7b
AK: Move to_int(), to_uint() implementations to StringUtils ( #1338 )
...
Provide wrappers in String and StringView. Add some tests for the
implementations.
2020-03-02 14:19:33 +01:00
howar6hill
055344f346
AK: Move the wildcard-matching implementation to StringUtils
...
Provide wrappers in the String and StringView classes, and add some tests.
2020-03-02 10:38:08 +01:00