1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:17:35 +00:00

AK: Move bijective-base-conversion into AK/String

This allows everybody to create a String version of their number
in a arbitrary bijective base. Bijective base meaning that the mapping
doesn't have a 0. In the usual mapping to the alphabet the follower
after 'Z' is 'AA'.
The mapping using the (uppercase) alphabet is used as a standard but
can be overridden specifying 'base' and 'map'.

The code was directly yanked from the Spreadsheet.
This commit is contained in:
Tobias Christiansen 2021-04-30 23:31:53 +02:00 committed by Linus Groh
parent 4dbf40399b
commit 4016e04061
2 changed files with 29 additions and 0 deletions

View file

@ -93,6 +93,8 @@ public:
[[nodiscard]] static String repeated(char, size_t count);
[[nodiscard]] static String bijective_base_from(size_t value, unsigned base = 26, StringView map = {});
template<class SeparatorType, class CollectionType>
[[nodiscard]] static String join(const SeparatorType& separator, const CollectionType& collection)
{