Add StringUtils::Copy for char to Char

This commit is contained in:
Wojtek Figat
2025-07-31 20:04:03 +02:00
parent 01617ae684
commit 7603109dce
2 changed files with 15 additions and 0 deletions

View File

@@ -28,6 +28,18 @@ int32 StringUtils::Copy(char* dst, const Char* src, int32 count)
return i;
}
int32 StringUtils::Copy(Char* dst, const char* src, int32 count)
{
int32 i = 0;
while (i < count && src[i])
{
dst[i] = (Char)src[i];
i++;
}
dst[i] = 0;
return i;
}
const Char* StringUtils::FindIgnoreCase(const Char* str, const Char* toFind)
{
if (toFind == nullptr || str == nullptr)

View File

@@ -128,6 +128,9 @@ public:
// Copies the string (count is maximum amount of characters to copy). Returns amount of copied elements (excluding null terminator character).
static int32 Copy(char* dst, const Char* src, int32 count);
// Copies the string (count is maximum amount of characters to copy). Returns amount of copied elements (excluding null terminator character).
static int32 Copy(Char* dst, const char* src, int32 count);
// Finds specific sub-string in the input string. Returns the first found position in the input string or nulll if failed.
static const Char* Find(const Char* str, const Char* toFind);