mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:37:44 +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:
parent
4dbf40399b
commit
4016e04061
2 changed files with 29 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue