mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:17:45 +00:00
AK+LibUnicode: Provide Unicode-aware String case transformations
Since AK can't refer to LibUnicode directly, the strategy here is that if you need case transformations, you can link LibUnicode and receive them. If you try to use either of these methods without linking it, then you'll of course get a linker error (note we don't do any fallbacks to e.g. ASCII case transformations). If you don't need these methods, you don't have to link LibUnicode.
This commit is contained in:
parent
12f6793223
commit
6fcc1c7426
6 changed files with 77 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/Concepts.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/Span.h>
|
||||
#include <AK/StringView.h>
|
||||
|
@ -43,6 +44,11 @@ public:
|
|||
// Creates a new String from a sequence of UTF-8 encoded code points.
|
||||
static ErrorOr<String> from_utf8(StringView);
|
||||
|
||||
// Creates a new String by transforming this String to lower- or uppercase. Using these methods
|
||||
// require linking LibUnicode into your application.
|
||||
ErrorOr<String> to_lowercase(Optional<StringView> const& locale = {}) const;
|
||||
ErrorOr<String> to_uppercase(Optional<StringView> const& locale = {}) const;
|
||||
|
||||
// Creates a substring with a deep copy of the specified data window.
|
||||
ErrorOr<String> substring_from_byte_offset(size_t start, size_t byte_count) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue