2022-07-23 15:36:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
2024-02-12 19:17:19 +00:00
|
|
|
#include <string_view>
|
2023-09-10 22:27:10 +01:00
|
|
|
#include <cstdint>
|
2023-01-21 13:37:56 +00:00
|
|
|
#include <vector>
|
2022-07-23 15:36:05 +01:00
|
|
|
|
2023-08-13 15:47:51 +01:00
|
|
|
namespace Services
|
2022-07-23 15:36:05 +01:00
|
|
|
{
|
2022-12-26 21:57:28 +00:00
|
|
|
class StringService
|
2022-07-23 15:36:05 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static std::string asciiToLower(std::string str);
|
|
|
|
|
|
|
|
|
|
static std::string asciiToUpper(std::string str);
|
|
|
|
|
|
|
|
|
|
static bool isAscii(const std::string& str);
|
2023-05-07 16:45:04 +01:00
|
|
|
static std::string replaceUnprintable(std::string str);
|
2023-01-21 13:37:56 +00:00
|
|
|
|
2023-09-10 22:27:10 +01:00
|
|
|
static std::string toHex(std::uint32_t value);
|
2023-01-21 13:37:56 +00:00
|
|
|
static std::string toHex(unsigned char value);
|
|
|
|
|
static std::string toHex(const std::vector<unsigned char>& data);
|
|
|
|
|
static std::string toHex(const std::string& data);
|
2024-02-12 19:17:19 +00:00
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
static std::vector<unsigned char> dataFromHex(const std::string& hexData);
|
|
|
|
|
|
|
|
|
|
static std::uint64_t toUint64(const std::string& str, int base = 0);
|
|
|
|
|
static std::uint32_t toUint32(const std::string& str, int base = 0);
|
|
|
|
|
static std::uint16_t toUint16(const std::string& str, int base = 0);
|
|
|
|
|
static std::uint8_t toUint8(const std::string& str, int base = 0);
|
|
|
|
|
|
|
|
|
|
static std::size_t hash(const std::string& str);
|
2024-02-12 19:17:19 +00:00
|
|
|
|
|
|
|
|
static std::vector<std::string_view> split(std::string_view str, char delimiter);
|
2022-07-23 15:36:05 +01:00
|
|
|
};
|
|
|
|
|
}
|