81 AgXString(
const char* str, size_type length );
143 bool operator== (
const std::string& other)
const;
153 bool operator!= (
const std::string& other)
const;
194 #define MAX_32BIT_INT 2147483647 359 void split(StringVector& result,
const AgXString& sep =
"",
int maxsplit = -1)
const;
368 void rsplit(StringVector& result,
const AgXString& sep =
"",
int maxsplit = -1)
const;
374 void splitlines(StringVector& result,
bool keepends =
false )
const;
441 template <
typename T>
444 template <
typename T>
465 #include <pystring/pystring.h> 474 va_start(ap, format);
486 int len = _vscprintf( format, ap ) + 1;
487 buf = (
char*) malloc( len *
sizeof(
char) );
489 vsprintf_s( buf, len, format, ap );
491 int ret = vasprintf(&buf, format, ap);
492 agxVerifyN(ret >= 0,
"Could not allocate memory for formatted string: \'%s\'", format);
508 template <
typename T>
514 template <
typename T>
521 template <
typename T>
527 template <
typename T>
533 template <
typename T>
539 template <
typename T>
546 template <
typename T>
548 : T( str, index, length )
553 template <
typename T>
559 template <
typename T>
567 template <
typename T>
575 template <
typename T>
583 template <
typename T>
589 template <
typename T>
592 return AgXString( this->c_str(), index, this->size() );
595 template <
typename T>
598 return AgXString( this->c_str(), index, length );
601 template <
typename T>
604 return static_cast<const std::string&
>(*this) ==
static_cast<const std::string&
>(other);
607 template <
typename T>
610 return *(std::string*)
this == other;
613 template <
typename T>
616 return *(std::string*)
this == other;
619 template <
typename T>
622 return *(std::string*)
this != other;
625 template <
typename T>
628 return *(std::string*)
this != other;
655 return pystring::capitalize(*
this);
661 return pystring::center(*
this, width);
667 return pystring::count(*
this, substr, start, end);
673 return pystring::endswith(*
this, suffix, start, end);
679 return pystring::endswithCI(*
this, suffix, start, end);
685 return pystring::expandtabs(*
this, tabsize);
698 return pystring::index(*
this, sub, start, end);
704 return pystring::isalnum(*
this);
710 return pystring::isalpha(*
this);
716 return pystring::isdigit(*
this);
722 return pystring::islower(*
this);
728 return pystring::isspace(*
this);
734 return pystring::istitle(*
this);
740 return pystring::isupper(*
this);
747 return pystring::ljust(*
this, width);
753 return pystring::lower(*
this);
760 std::size_t start = this->find(toBeRemoved);
762 if (T::length() > toBeRemoved.size()) {
763 return this->substr(toBeRemoved.size(), T::length() );
774 return pystring::lstrip(*
this, chars);
780 return pystring::partition(*
this, sep, result);
786 return pystring::replace(*
this, oldstr, newstr, count);
792 int index = pystring::find(*
this, sub, start, end);
793 return index < 0 ? AgXString<T>::npos : (size_t)index;
799 int index = pystring::rfind(*
this, sub, start, end);
800 return index < 0 ? AgXString<T>::npos : (size_t)index;
807 return pystring::rjust(*
this, width);
813 return pystring::rpartition(*
this, sep, result);
819 return pystring::rstrip(*
this, chars);
825 return pystring::split(*
this, result, sep, maxsplit);
831 return pystring::rsplit(*
this, result, sep, maxsplit);
837 return pystring::splitlines(*
this, result, keepends);
843 return pystring::startswith(*
this, prefix, start, end);
849 return pystring::startswithCI(*
this, prefix, start, end);
855 if (this->size() == 0)
858 return pystring::strip(*
this, chars);
864 return pystring::swapcase(*
this);
870 return pystring::title(*
this);
876 return pystring::translate(*
this, table, deletechars);
882 return pystring::upper(*
this);
888 return pystring::zfill(*
this, width);
894 return pystring::slice(*
this, start, end);
898 template <
typename T>
904 template <
typename T>
916 std::swap(static_cast<std::string&>(lhs), static_cast<std::string&>(rhs));
Vector< AgXString< std::string > > StringVector
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.
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
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.
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
The agx namespace 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)
AGXCORE_EXPORT const agx::String & getEmptyString()
Return a reference to an empty string that is owned by an AGX Dynamics shared library.
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 operator==(const AgXString &other) const
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.