mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added a Maxsi::String::Substring function.
This commit is contained in:
parent
edd806fc74
commit
75b3b9c858
2 changed files with 11 additions and 0 deletions
|
@ -37,6 +37,7 @@ namespace Maxsi
|
|||
size_t Reject(const char* str, const char* reject);
|
||||
char* Clone(const char* Source);
|
||||
char* Combine(size_t NumParameters, ...);
|
||||
char* Substring(const char* src, size_t offset, size_t length);
|
||||
char* Copy(char* Dest, const char* Src);
|
||||
char* Cat(char* Dest, const char* Src);
|
||||
char* Tokenize(char* str, const char* delim);
|
||||
|
|
|
@ -199,6 +199,16 @@ namespace Maxsi
|
|||
return Result;
|
||||
}
|
||||
|
||||
char* Substring(const char* src, size_t offset, size_t length)
|
||||
{
|
||||
size_t srclen = Length(src);
|
||||
char* dest = new char[length + 1];
|
||||
if ( !dest ) { return NULL; }
|
||||
Memory::Copy(dest, src + offset, length * sizeof(char));
|
||||
dest[length] = 0;
|
||||
return dest;
|
||||
}
|
||||
|
||||
DUAL_FUNCTION(int, atoi, ToInt, (const char* str))
|
||||
{
|
||||
bool negative = ( *str == '-' );
|
||||
|
|
Loading…
Add table
Reference in a new issue