Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
CStringTools.hpp
Go to the documentation of this file.
1#ifndef LIBS_CORE_CSTRINGTOOLS_HPP_
2#define LIBS_CORE_CSTRINGTOOLS_HPP_
3
4#include <bits/stdint-uintn.h>
5#include <string>
6
8
10{
11public:
18 static char *createCopyMemory(const void *bufferSrc, uint64_t numBytes);
19
25 static std::string convertToUTF8(std::string_view text);
26
32 static char *copy(const char *str);
33 static void copyBuffer(const std::string &str, uint64_t sizeBuffer, char *buffer);
34 static void copyMemory(void *bufferDst, const void *bufferSrc, uint64_t numBytes);
35 static void copyMemoryReversed(void *bufferDst, const void *bufferSrc, uint64_t numBytes);
36
37 static void deleteCharIntoString(char *stringBuffer, uint64_t indPos);
38
39 static void insertCharIntoString(char *stringBuffer, uint64_t tamBuffer, uint64_t indPos, char charInsert);
40 static void memoryInitialize(void *buffer, uint64_t numBytes, unsigned char value);
41
42 static std::string generateRandomPasswordString(uint32_t minLength, uint32_t maxLength, bool lowerTypes,
43 bool upperTypes, bool numTypes);
44
45 static std::vector<std::string> split(const std::string &str, std::string_view separator);
46 static std::vector<std::string> splitByLength(const std::string &str, uint64_t maxLength);
47
48 static std::string strDate(uint16_t day, uint16_t month, uint16_t year);
49 static std::string strTime(uint16_t hour, uint16_t minutes, uint16_t seconds);
50
51 static char *initialExtractUntilChar(const char *str, char c);
52 static char *endExtractFromChar(const char *str, char c);
53
54 static std::string truncateWithPoints(const std::string &str, uint64_t maxLength);
55};
56
57#endif /* LIBS_CORE_CSTRINGTOOLS_HPP_ */
Definition CStringTools.hpp:10
static std::string generateRandomPasswordString(uint32_t minLength, uint32_t maxLength, bool lowerTypes, bool upperTypes, bool numTypes)
Genera un string aleatorio con el tamaño comprendido entre el min y max con mínimo un caracter de cad...
Definition CStringTools.cpp:141
static std::string strTime(uint16_t hour, uint16_t minutes, uint16_t seconds)
Returns a formatted string of the time.
Definition CStringTools.cpp:357
static char * endExtractFromChar(const char *str, char c)
Extract the existent substring from the last occurrence of the given char.
Definition CStringTools.cpp:225
static std::string convertToUTF8(std::string_view text)
Convert the given text to UTF-8.
Definition CStringTools.cpp:389
static char * createCopyMemory(const void *bufferSrc, uint64_t numBytes)
Create from an existent buffer.
Definition CStringTools.cpp:33
static void memoryInitialize(void *buffer, uint64_t numBytes, unsigned char value)
Initialize the buffer with the given char the number of bytes given.
Definition CStringTools.cpp:250
static std::vector< std::string > split(const std::string &str, std::string_view separator)
Splits the given string into an array of substrings separated by the separator given.
Definition CStringTools.cpp:263
static void insertCharIntoString(char *stringBuffer, uint64_t tamBuffer, uint64_t indPos, char charInsert)
Insert a character into a position of a string.
Definition CStringTools.cpp:114
static void copyMemoryReversed(void *bufferDst, const void *bufferSrc, uint64_t numBytes)
Copy memory from bufferSrc to bufferDst in a reverse way.
Definition CStringTools.cpp:50
static void deleteCharIntoString(char *stringBuffer, uint64_t indPos)
Remove the character at position, next characters are displaced to left.
Definition CStringTools.cpp:96
static void copyMemory(void *bufferDst, const void *bufferSrc, uint64_t numBytes)
Copies the memory from bufferSrc to bufferDst the amount of bytes given in <numBytes>
Definition CStringTools.cpp:19
static char * initialExtractUntilChar(const char *str, char c)
Extracts the substring from the beggining to the last instance of the given char.
Definition CStringTools.cpp:195
static std::string truncateWithPoints(const std::string &str, uint64_t maxLength)
Definition CStringTools.cpp:430
static char * copy(const char *str)
Create a copy of the given buffer.
Definition CStringTools.cpp:454
static std::vector< std::string > splitByLength(const std::string &str, uint64_t maxLength)
Splits a given message into smaller sizes messages to fit in a maximum length.
Definition CStringTools.cpp:311
static void copyBuffer(const std::string &str, uint64_t sizeBuffer, char *buffer)
Definition CStringTools.cpp:71
static std::string strDate(uint16_t day, uint16_t month, uint16_t year)
Returns a formatted string of the date.
Definition CStringTools.cpp:374