substring method

This commit is contained in:
2026-04-27 18:53:25 -04:00
parent 37967b9f94
commit e8dc131f3c
8 changed files with 9 additions and 1 deletions

Binary file not shown.

View File

@ -93,6 +93,7 @@ public:
void remove(const int ind); void remove(const int ind);
void remove(const int ind1, const int ind2); void remove(const int ind1, const int ind2);
void substring(const int ind1, const int ind2, amsstring *sout) const; void substring(const int ind1, const int ind2, amsstring *sout) const;
amsstring substring(const int ind1, const int ind2) const;
//Append //Append
void append(const amsstring &other); void append(const amsstring &other);

View File

@ -654,6 +654,13 @@ namespace ams
return; return;
} }
amsstring amsstring::substring(const int ind1, const int ind2) const
{
amsstring ret;
this->substring(ind1,ind2,&ret);
return ret;
}
void amsstring::append(const amsstring &other) void amsstring::append(const amsstring &other)
{ {
this->insert(this->length,other); this->insert(this->length,other);

View File

@ -140,7 +140,7 @@ int amssprintf_s(char *s, int n, const char *format, ...)
//va_arg(val,datatype) //va_arg(val,datatype)
// if(s!=NULL) // if(s!=NULL)
// { // {
#if defined(LINUX) || defined(linux) || defined(__linux__) || defined(__GNUC__) #if defined(LINUX) || defined(linux) || defined(__linux__) || defined(__GNUC__) || defined(__APPLE__) || defined(__MACH__)
//use snprintf //use snprintf
ret = (int)vsnprintf(s,n,format,args); ret = (int)vsnprintf(s,n,format,args);
s[n-1] = '\0'; s[n-1] = '\0';