blob: 5251d310bd9588159f4a3ec01fd00d619d8ac549 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/*
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibUnicode/UnicodeUtils.h>
// This file contains definitions of AK::String methods which require UCD data.
namespace AK {
ErrorOr<String> String::to_lowercase(Optional<StringView> const& locale) const
{
StringBuilder builder;
TRY(Unicode::Detail::build_lowercase_string(code_points(), builder, locale));
return builder.to_string();
}
ErrorOr<String> String::to_uppercase(Optional<StringView> const& locale) const
{
StringBuilder builder;
TRY(Unicode::Detail::build_uppercase_string(code_points(), builder, locale));
return builder.to_string();
}
ErrorOr<String> String::to_titlecase(Optional<StringView> const& locale) const
{
StringBuilder builder;
TRY(Unicode::Detail::build_titlecase_string(code_points(), builder, locale));
return builder.to_string();
}
}
|