2020-09-17 23:02:40 +03:00
|
|
|
// Copyright (c) Vitaliy Filippov, 2019+
|
2021-02-06 01:26:07 +03:00
|
|
|
// License: VNPL-1.1 (see README.md for details)
|
2020-09-17 23:02:40 +03:00
|
|
|
|
2020-04-11 12:04:10 +03:00
|
|
|
#pragma once
|
2022-07-15 02:19:35 +03:00
|
|
|
#include <stdint.h>
|
2020-04-11 12:04:10 +03:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
std::string base64_encode(const std::string &in);
|
|
|
|
std::string base64_decode(const std::string &in);
|
2022-08-22 00:31:30 +03:00
|
|
|
uint64_t parse_size(std::string size_str, bool *ok = NULL);
|
2022-12-24 16:07:02 +03:00
|
|
|
std::string strtoupper(const std::string & in);
|
2022-08-06 02:04:58 +03:00
|
|
|
std::string strtolower(const std::string & in);
|
2022-08-14 02:13:24 +03:00
|
|
|
std::string trim(const std::string & in, const char *rm_chars = " \n\r\t");
|
2022-08-12 01:58:28 +03:00
|
|
|
std::string str_replace(const std::string & in, const std::string & needle, const std::string & replacement);
|
2022-07-15 02:19:35 +03:00
|
|
|
uint64_t stoull_full(const std::string & str, int base = 0);
|
|
|
|
std::string format_size(uint64_t size, bool nobytes = false);
|
2022-07-31 01:10:05 +03:00
|
|
|
void print_help(const char *help_text, std::string exe_name, std::string cmd, bool all);
|
2023-02-21 00:21:23 +03:00
|
|
|
uint64_t parse_time(std::string time_str, bool *ok = NULL);
|
2023-04-20 23:36:08 +03:00
|
|
|
std::string read_all_fd(int fd);
|
2023-06-17 20:59:28 +03:00
|
|
|
std::string str_repeat(const std::string & str, int times);
|
2023-07-25 04:39:47 +03:00
|
|
|
size_t utf8_length(const std::string & s);
|
|
|
|
size_t utf8_length(const char *s);
|