139 bool operator== (
const std::string& other)
const;
149 bool operator!= (
const std::string& other)
const;
190 #define MAX_32BIT_INT 2147483647 355 void split(StringVector& result,
const AgXString& sep =
"",
int maxsplit = -1)
const;
364 void rsplit(StringVector& result,
const AgXString& sep =
"",
int maxsplit = -1)
const;
370 void splitlines(StringVector& result,
bool keepends =
false )
const;
428 template <
typename T>
431 template <
typename T>
451 #include <external/pystring/pystring.h> 460 va_start(ap, format);
472 int len = _vscprintf( format, ap ) + 1;
473 buf = (
char*) malloc( len *
sizeof(
char) );
475 vsprintf_s( buf, len, format, ap );
477 int ret = vasprintf(&buf, format, ap);
478 agxVerifyN(ret >= 0,
"Could not allocate memory for formatted string: \'%s\'", format);
494 template <
typename T>
500 template <
typename T>
507 template <
typename T>
513 template <
typename T>
519 template <
typename T>
525 template <
typename T>
532 template <
typename T>
534 : T( str, index, length )
539 template <
typename T>
545 template <
typename T>
553 template <
typename T>
561 template <
typename T>
569 template <
typename T>
575 template <
typename T>
578 return AgXString( this->c_str(), index, this->size() );
581 template <
typename T>
584 return AgXString( this->c_str(), index, length );
587 template <
typename T>
590 return *(std::string*)
this == other;
593 template <
typename T>
596 return *(std::string*)
this == other;
599 template <
typename T>
602 return *(std::string*)
this != other;
605 template <
typename T>
608 return *(std::string*)
this != other;
635 return pystring::capitalize(*
this);
641 return pystring::center(*
this, width);
647 return pystring::count(*
this, substr, start, end);
653 return pystring::endswith(*
this, suffix, start, end);
659 return pystring::endswithCI(*
this, suffix, start, end);
665 return pystring::expandtabs(*
this, tabsize);
678 return pystring::index(*
this, sub, start, end);
684 return pystring::isalnum(*
this);
690 return pystring::isalpha(*
this);
696 return pystring::isdigit(*
this);
702 return pystring::islower(*
this);
708 return pystring::isspace(*
this);
714 return pystring::istitle(*
this);
720 return pystring::isupper(*
this);
727 return pystring::ljust(*
this, width);
733 return pystring::lower(*
this);
740 std::size_t start = this->find(toBeRemoved);
743 return this->substr(toBeRemoved.size(),
T::length() );
754 return pystring::lstrip(*
this, chars);
760 return pystring::partition(*
this, sep, result);
766 return pystring::replace(*
this, oldstr, newstr, count);
772 int index = pystring::find(*
this, sub, start, end);
773 return index < 0 ? AgXString<T>::npos : (size_t)index;
779 int index = pystring::rfind(*
this, sub, start, end);
780 return index < 0 ? AgXString<T>::npos : (size_t)index;
787 return pystring::rjust(*
this, width);
793 return pystring::rpartition(*
this, sep, result);
799 return pystring::rstrip(*
this, chars);
805 return pystring::split(*
this, result, sep, maxsplit);
811 return pystring::rsplit(*
this, result, sep, maxsplit);
817 return pystring::splitlines(*
this, result, keepends);
823 return pystring::startswith(*
this, prefix, start, end);
829 return pystring::startswithCI(*
this, prefix, start, end);
835 if (this->size() == 0)
838 return pystring::strip(*
this, chars);
844 return pystring::swapcase(*
this);
850 return pystring::title(*
this);
856 return pystring::translate(*
this, table, deletechars);
862 return pystring::upper(*
this);
868 return pystring::zfill(*
this, width);
874 return pystring::slice(*
this, start, end);
878 template <
typename T>
884 template <
typename T>
896 std::swap(static_cast<std::string&>(lhs), static_cast<std::string&>(rhs));
void partition(const AgXString &sep, StringVector &result) const
Split the string around first occurrence of sep.
AgXString capitalize() const
void rpartition(const AgXString &sep, StringVector &result) const
Split the string around last occurrence of sep.
bool operator==(const std::string &other) const
AgXString strip(const AgXString &chars="") const
AgXString expandtabs(int tabsize=8) const
#define agxVerifyN(expr, format,...)
AgXString replace(const AgXString &oldstr, const AgXString &newstr, int count=-1) const
agx::String AGXCORE_EXPORT printHex(Real64 val)
bool operator==(T val, InvalidIndexStruct)
std::string::iterator iterator
AgXString translate(const AgXString &table, const AgXString &deletechars="") const
AgXString< std::string > String
size_t rfind(const AgXString &sub, int start=0, int end=MAX_32BIT_INT) const
GLenum GLuint GLenum GLsizei length
int index(const AgXString &sub, int start=0, int end=MAX_32BIT_INT) const
Synonym of find right now.
void swap(agx::Name &lhs, agx::Name &rhs)
AgXString stripLeadingString(const AgXString &toBeRemoved) const
If this string begins with toBeRemoved, it will be removed and returned.
size_t find(const AgXString &sub, int start=0, int end=MAX_32BIT_INT) const
void swap(agx::String &lhs, agx::String &rhs)
AgXString operator+(const AgXString &other) const
Operator +, AgXString b = thisAgXString + other.
Vector< AgXString< std::string > > StringVector
AgXString slice(int start=0, int end=MAX_32BIT_INT) const
function matching python's slice functionality.
agx::String printBin(const T &val)
std::string::size_type size_type
std::string::const_iterator const_iterator
AgXString swapcase() const
Namespace agx contains the dynamics/math part of the AGX Dynamics API.
bool endswithCI(const AgXString &suffix, int start=0, int end=MAX_32BIT_INT) const
AgXString substr(size_type index) const
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
AgXString zfill(int width) const
AgXString rstrip(const AgXString &chars="") const
int count(const AgXString &substr, int start=0, int end=MAX_32BIT_INT) const
AgXString center(int width) const
bool endswith(const AgXString &suffix, int start=0, int end=MAX_32BIT_INT) const
agx::String AGXCORE_EXPORT printBin(Real64 val)
static AgXString formatVA(const char *format, va_list ap)
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
bool operator!=(T val, InvalidIndexStruct)
AgXString lstrip(const AgXString &chars="") const
void splitlines(StringVector &result, bool keepends=false) const
AgXString rjust(int width) const
AgXString< T > operator+(const char elem, const AgXString< T > &str)
void split(StringVector &result, const AgXString &sep="", int maxsplit=-1) const
Fills the "result" list with the words in the string, using sep as the delimiter string.
bool operator!=(const std::string &other) const
agx::String printHex(const T &val)
bool contains(const AgXString &sub, size_t start=0) const
static AgXString format(const char *format,...)
C printf formatting of a string.
AgXString ljust(int width) const
AgXString()
Default constructor.
bool startswith(const AgXString &prefix, int start=0, int end=MAX_32BIT_INT) const
AgXString copy() const
Copy method, if implementation of this class is changed.
bool startswithCI(const AgXString &prefix, int start=0, int end=MAX_32BIT_INT) const
void rsplit(StringVector &result, const AgXString &sep="", int maxsplit=-1) const
Fills the "result" list with the words in the string, using sep as the delimiter string.