HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_String Class Reference

#include <UT_String.h>

+ Inheritance diagram for UT_String:

Public Types

enum  UT_AlwaysDeepType { ALWAYS_DEEP }
 

Public Member Functions

SYS_FORCE_INLINE UT_String (const char *str=0)
 Construct UT_String from a C string, using shallow semantics. More...
 
 UT_String (const char *str, bool deep_copy, int len=-1)
 Construct UT_String from a C string, using shallow semantics. More...
 
 UT_String (const std::string &str)
 Construct UT_String from a std::string, always doing a deep copy. The result will only be a UT_AlwaysDeep if the appropriate version is used, however! More...
 
 UT_String (const UT_StringHolder &str)
 Construct UT_String from a UT_StringHolder. This always duplicates and uses ALWAYS_DEEP semantics. More...
 
 UT_String (UT_StringHolder &&str)
 Construct UT_String from a UT_StringHolder rvalue with ALWAYS_DEEP semantics. More...
 
 UT_String (const UT_StringView &sv)
 Construct UT_String from a UT_StringView. This always duplicates and uses ALWAYS_DEEP semantics. More...
 
 UT_String (UT_AlwaysDeepType, const char *str=0)
 Construct UT_String from a C string, using ALWAYS_DEEP semantics. More...
 
 UT_String (UT_AlwaysDeepType, const std::string &str)
 Construct UT_String from a std::string, using ALWAYS_DEEP semantics. More...
 
 UT_String (const UT_String &str)
 
 ~UT_String ()
 
void setAlwaysDeep (bool deep)
 Make a string always deep. More...
 
bool isAlwaysDeep () const
 
void swap (UT_String &other)
 
bool isHard () const
 Returns whether this string is hardened already. More...
 
char * steal ()
 
void saveBinary (std::ostream &os) const
 Save string to binary stream. More...
 
void saveAscii (std::ostream &os) const
 
void saveAscii (UT_OStream &os) const
 
void save (std::ostream &os, bool binary) const
 Save string to stream. Saves as binary if binary is true. More...
 
void save (UT_OStream &os, bool binary) const
 
bool load (UT_IStream &is)
 Load string from stream. Use is.eof() to check eof status. More...
 
void clear ()
 Reset the string to the default constructor. More...
 
void append (char ch)
 Append a character. More...
 
void append (const char *str, exint len=-1)
 Append a string or a section of a string. More...
 
void removeLast ()
 Remove the last character. More...
 
void truncate (exint len)
 Truncate the string at the Nth character. More...
 
UT_Stringoperator= (const UT_String &str)
 
UT_Stringoperator= (const char *str)
 
UT_Stringoperator= (const std::string &str)
 
UT_Stringoperator= (const UT_StringHolder &str)
 
UT_Stringoperator= (UT_StringHolder &&str)
 
UT_Stringoperator= (const UT_StringView &str)
 
UT_Stringoperator+= (const char *str)
 
UT_Stringoperator+= (const UT_String &str)
 
UT_Stringoperator+= (const UT_StringRef &str)
 
int compare (const char *str, bool case_sensitive=true) const
 
int compare (const UT_String &str, bool case_sensitive=true) const
 
int compare (const UT_StringRef &str, bool case_sensitive=true) const
 
bool equal (const char *str, bool case_sensitive=true) const
 
bool equal (const UT_String &str, bool case_sensitive=true) const
 
bool equal (const UT_StringRef &str, bool case_sensitive=true) const
 
bool operator== (const char *str) const
 
bool operator== (const UT_String &str) const
 
bool operator== (const UT_StringRef &str) const
 
bool operator!= (const char *str) const
 
bool operator!= (const UT_String &str) const
 
bool operator!= (const UT_StringRef &str) const
 
bool operator< (const char *str) const
 
bool operator< (const UT_String &str) const
 
bool operator< (const UT_StringRef &str) const
 
bool operator<= (const char *str) const
 
bool operator<= (const UT_String &str) const
 
bool operator<= (const UT_StringRef &str) const
 
bool operator> (const char *str) const
 
bool operator> (const UT_String &str) const
 
bool operator> (const UT_StringRef &str) const
 
bool operator>= (const char *str) const
 
bool operator>= (const UT_String &str) const
 
bool operator>= (const UT_StringRef &str) const
 
SYS_SAFE_BOOL operator bool () const
 Test whether the string is defined or not. More...
 
int distance (const char *str, bool case_sensitive=true, bool allow_subst=true) const
 
 operator const char * () const
 
 operator char * ()
 
 operator UT_StringView () const
 
const char * c_str () const
 
const char * buffer () const
 
const char * data () const
 
const char * nonNullBuffer () const
 
char operator() (unsigned i) const
 
char & operator() (unsigned i)
 
void write (unsigned i, char c)
 
int toInt () const
 
fpreal toFloat () const
 
std::string toStdString () const
 
unsigned length () const
 Return length of string. More...
 
int64 getMemoryUsage (bool inclusive=true) const
 Return memory usage in bytes. More...
 
int countChar (int c) const
 Return the number of occurrences of the specified character. More...
 
int count (const char *str, bool case_sensitive=true) const
 Count the occurrences of the string. More...
 
char * findNonSpace ()
 
const char * findNonSpace () const
 
const char * findWord (const char *word) const
 
bool findString (const char *str, bool fullword, bool usewildcards) const
 
int changeWord (const char *from, const char *to, bool all=true)
 
int changeString (const char *from, const char *to, bool fullword)
 
int changeQuotedWord (const char *from, const char *to, int quote= '`', bool all=true)
 
int findLongestCommonSuffix (const char *with) const
 
int substr (UT_String &buf, int index, int len=0) const
 
bool isFloat (bool skip_spaces=false, bool loose=false, bool allow_underscore=false) const
 Determine if string can be seen as a single floating point number. More...
 
bool isInteger (bool skip_spaces=false) const
 Determine if string can be seen as a single integer number. More...
 
void toUpper ()
 
void toLower ()
 
const char * fileName () const
 
bool matchFileExtension (const char *match_extension) const
 
UT_String pathUpToExtension () const
 
UT_String replaceExtension (const UT_String &new_ext) const
 Replace the file extension and return the new string. More...
 
void splitPath (UT_String &dir_name, UT_String &file_name) const
 
int parseNumberedFilename (UT_String &prefix, UT_String &frame, UT_String &suff, bool negative=true, bool fractional=false) const
 
bool isstring () const
 
int trimSpace (bool leave_single_space_between_words=false)
 
int trimBoundingSpace ()
 
int strip (const char *chars)
 
void protectString (bool protect_empty=false)
 
void protectPreQuotePythonStringLiteral (char delimiter='\'')
 protectPreQuotePythonStringLiteral() will modify the existing string More...
 
bool isQuotedString (char delimiter='\'') const
 
UT_String makeQuotedString (char delimiter='\'', bool escape_nonprinting=false) const
 
UT_String makeSmartQuotedString (char default_delimiter='\'', bool escape_nonprinting=false) const
 
void expandControlSequences (bool expand_extended=false)
 
bool hasWhiteSpace () const
 
void removeTrailingSpace ()
 
void removeTrailingChars (char chr)
 
void removeTrailingDigits ()
 
int cshParse (char *argv[], int max_args, void(*vlookup)(const char *, UT_String &)=UTvarLookup, void(*elookup)(const char *, UT_String &)=UTexprLookup, int *error=0, UT_StringCshIO *io=0)
 
int cshParse (UT_WorkArgs &argv, void(*vlookup)(const char *, UT_String &)=UTvarLookup, void(*elookup)(const char *, UT_String &)=UTexprLookup, int *error=0, UT_StringCshIO *io=0)
 
int dosParse (UT_WorkArgs &argv, bool preserve_backslashes=false)
 
int dosParse (char *argv[], int max_args, bool preserve_backslashes=false)
 
int parse (char *argv[], int max_args, const char *quotes="\"'", bool keep_quotes=false)
 
int parse (UT_WorkArgs &argv, int start_arg=0, const char *quotes="\"'", bool keep_quotes=false)
 
int parse (UT_StringArray &argv, int start_arg=0, const char *quotes="\"'", bool keep_quotes=false)
 
int parseInPlace (char *argv[], int max_args, const char *quotes="\"'", bool keep_quotes=false)
 
int parseInPlace (UT_WorkArgs &argv, int start_arg=0, const char *quotes="\"'", bool keep_quotes=false)
 
int parseInPlace (UT_StringArray &argv, int start_arg=0, const char *quotes="\"'", bool keep_quotes=false)
 
int tokenize (char *argv[], int max_args, char separator)
 
int tokenizeInPlace (char *argv[], int max_args, char separator)
 
int tokenize (UT_WorkArgs &argv, char separator)
 
int tokenizeInPlace (UT_WorkArgs &argv, char separator)
 
int tokenize (char *argv[], int max_args, const char *separators=" \t\n")
 
int tokenizeInPlace (char *argv[], int max_args, const char *separators=" \t\n")
 
int tokenize (UT_WorkArgs &argv, const char *separators=" \t\n")
 
int tokenizeInPlace (UT_WorkArgs &argv, const char *separators=" \t\n")
 
template<typename T >
int tokenize (T &list, const char *separators=" \t\n")
 
template<typename T >
int tokenizeInPlace (T &list, const char *separators=" \t\n")
 
void expandVariables ()
 
SYS_FORCE_INLINE uint32 hash () const
 
bool match (const char *pattern, bool case_sensitive=true) const
 
bool matchFile (const char *pattern) const
 
bool matchPath (const char *pattern, bool case_sensitive=true, bool *excludes_branch=nullptr) const
 
bool multiMatch (const char *pattern, bool case_sensitive, char separator) const
 
bool multiMatch (const char *pattern, bool case_sensitive=true, const char *separators=", ", bool *explicitly_excluded=0, int *match_index=0, ut_PatternRecord *pattern_record=NULL) const
 
bool multiMatch (const UT_StringMMPattern &pattern, bool *explicitly_excluded=0, int *match_index=0, ut_PatternRecord *pattern_record=NULL) const
 
bool multiMatchRecord (const char *pattern, int maxpatterns, char *singles, int &nsingles, char **words, int &nwords, bool case_sensitive=true, const char *separators=", ") const
 
bool multiMatchRecord (const UT_StringMMPattern &pattern, int maxpatterns, char *singles, int &nsingles, char **words, int &nwords) const
 
bool multiMatchRecord (const char *pattern, UT_StringHolder &singles, UT_StringArray &words, bool case_sensitive=true, const char *separators=", ") const
 
bool matchPattern (const UT_WorkArgs &pattern_args, bool assume_match=false) const
 
bool contains (const char *pattern, bool case_sensitive=true) const
 
bool startsWith (const UT_StringView &prefix, bool case_sensitive=true) const
 
bool endsWith (const UT_StringView &suffix, bool case_sensitive=true) const
 
void pluralize ()
 
int traversePattern (int max, void *data, int(*func)(int num, int sec, void *data), unsigned int(*secfunc)(int num, void *data)=0, int offset=0) const
 
const char * fcontain (const char *pattern, bool case_sensitive=true) const
 
bool patternRename (const char *match_pattern, const char *replace)
 
const char * base (UT_String &buf) const
 
const char * suffix () const
 
void incrementNumberedName (bool preserve_padding=false)
 
std::ostream & setFormat (std::ostream &os)
 
int replacePrefix (const char *oldpref, const char *newpref)
 
int replaceSuffix (const char *oldsuffix, const char *newsuffix)
 
int expandArrays (char *names[], int max)
 
int format (int cols)
 
int substitute (const char *find, const char *replacement, int count=-1)
 
int substitute (const char *find, const char *replacement, bool all)
 Convenience version of substitute() for all or single occurrence. More...
 
int substitute (char find, char replacement, bool all=true)
 
int replace (int pos, int len, const char *str)
 
int eraseHead (int len)
 
int eraseTail (int len)
 
int erase (int pos=0, int len=-1)
 
int insert (int pos, const char *str)
 
void extractProgramName (const char *path, bool strip_extension=true, bool normalize_path=true)
 
void normalizePath ()
 
void itoa (int64 i)
 
void utoa (uint64 i)
 
void itoaPretty (int64 val)
 
void timeDeltaToPrettyString (double time_ms)
 
void timeDeltaToPrettyStringMS (double time_ms)
 
int sprintf (const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
 
int int forceValidVariableName (const char *safechars=NULL)
 
bool isValidVariableName (const char *safechars=NULL) const
 
bool forceAlphaNumeric ()
 
void getRelativePath (const char *src_fullpath, const char *dest_fullpath, bool file_path=false)
 
bool isAbsolutePath (bool file_path=false) const
 
bool collapseAbsolutePath (bool file_path=false)
 
bool truncateMiddle (int max_length)
 
bool applyCshModifiers (const char *modifiers)
 
UT_String removeRange ()
 
void formatByteSize (exint size, int digits=2)
 
int getCodePointCount () const
 
void getAsCodePoints (UT_Int32Array &cp_list) const
 Returns a list of Unicode code points from this string. More...
 
int expandArrays (UT_StringArray &tokens, UT_StringArray &names)
 
 UT_String (UT_String &&str) noexcept
 
UT_Stringoperator= (UT_String &&str)
 
void harden ()
 Take shallow copy and make it deep. More...
 
void harden (const char *s, int len=-1)
 Take shallow copy and make it deep. More...
 
void hardenIfNeeded ()
 Take shallow copy and make it deep. More...
 
void hardenIfNeeded (const char *s)
 Take shallow copy and make it deep. More...
 
void adopt (char *s)
 
void adopt (UT_String &str)
 
void adopt (UT_StringHolder &holder)
 
void prepend (const char *prefix)
 Prepend a string (or character) More...
 
void prepend (char ch)
 Prepend a string (or character) More...
 
char * findChar (int c)
 
const char * findChar (int c) const
 
char * findChar (const char *str)
 
const char * findChar (const char *str) const
 
char * lastChar (int c)
 
const char * lastChar (int c) const
 
char * fileExtension ()
 
const char * fileExtension () const
 

Static Public Member Functions

static void protectString (std::ostream &os, char c)
 
static int dosParse (char *buffer, UT_WorkArgs &args, bool preserve_backslashes)
 
static SYS_FORCE_INLINE uint32 hash (const char *str, uint32 code=0)
 
static bool multiMatchCheck (const char *pattern)
 
static bool wildcardMatchCheck (const char *pattern)
 
static std::ostream & setFormat (std::ostream &os, const char *fmt)
 
static int compareNumberedString (const char *s1, const char *s2, bool case_sensitive=true, bool allow_negatives=false)
 
static int qsortCmpNumberedString (const char *const *v1, const char *const *v2)
 
static int compareNumberedFilename (const char *s1, const char *s2, bool case_sensitive=false)
 
static int qsortCmpNumberedFilename (const char *const *v1, const char *const *v2)
 
static int compareNumberedStringWithExceptions (const char *s1, const char *s2, bool case_sensitive=false, bool allow_negatives=false, const char *sorted_first=nullptr, const char *sorted_last=nullptr)
 
static int compareVersionString (const char *s1, const char *s2)
 
static bool matchProgramName (const char *path, const char *expected, bool normalize_path=false)
 
static int itoa (char *str, int64 i)
 
static int utoa (char *str, uint64 i)
 
static int findLongestCommonPathPrefix (const char *fullpath1, int len1, const char *fullpath2, int len2)
 
static const UT_StringgetEmptyString ()
 
static int countCshModifiers (const char *src)
 

Friends

class UT_API UT_StringRef
 
void swap (UT_String &a, UT_String &b)
 
UT_API std::ostream & operator<< (std::ostream &os, const UT_String &d)
 
UT_API UT_OStreamoperator<< (UT_OStream &os, const UT_String &d)
 

Detailed Description

UT_String is a string class that support two different types of assignment semantics:

  • Shallow (default): Just reference the given string and NOT take ownership.
  • Deep: Make a copy of the given string, taking ownership in the process (aka it making it "hard").

If UT_String::harden() is called, or any other UT_String method that requires modifying the string, it will make a copy of its reference pointer (and take ownership) first.

Examples:
CHOP/CHOP_Spring.h, CHOP/CHOP_Stair.C, CHOP/CHOP_Stair.h, DM/DM_InfoHook.C, DM/DM_ObjectPathHook.C, DOP/DOP_GroupAndApply.C, DOP/DOP_GroupAndApply.h, expr/globalvar.C, field3d/f3d_io.C, field3d/GEO_Field3DTranslator.C, field3d/ROP_Field3D.C, field3d/ROP_Field3D.h, FS/FS_Background.C, FS/FS_HomeHelper.C, FS/FS_HomeHelper.h, GEO/GEO_VoxelTranslator.C, LOP/LOP_Sphere.C, LOP/LOP_Sphere.h, OBJ/OBJ_WorldAlign.C, OPUI/OPUI_MemUsageTextBadge.C, packedshareddata/GU_PackedSharedData.C, RAY/RAY_DemoSprite.C, ROP/ROP_Dumper.C, ROP/ROP_Dumper.h, SHOP/SHOP_Multi.C, SHOP/SHOP_Multi.h, SHOP/SHOP_POVMaterial.C, SHOP/SHOP_POVMaterial.h, SIM/GAS_NetVDBSliceExchange.C, SIM/SNOW_Solver.C, SOP/MSS_BrushHairLen.C, SOP/MSS_BrushHairLen.h, SOP/MSS_CustomBrushState.C, SOP/SOP_ArrayAttrib.C, SOP/SOP_ArrayAttrib.h, SOP/SOP_BlindData.C, SOP/SOP_BlindData.h, SOP/SOP_BouncyAgent.C, SOP/SOP_BouncyAgent.h, SOP/SOP_BrushHairLen.h, SOP/SOP_Cop2Raster.C, SOP/SOP_Cop2Raster.h, SOP/SOP_CustomBrush.C, SOP/SOP_CustomBrush.h, SOP/SOP_DetailAttrib.C, SOP/SOP_DetailAttrib.h, SOP/SOP_Flatten.h, SOP/SOP_GroupRename.C, SOP/SOP_GroupRename.h, SOP/SOP_HDKObject.C, SOP/SOP_HDKObject.h, SOP/SOP_PointWave.h, SOP/SOP_PrimVOP.C, SOP/SOP_PrimVOP.h, SOP/SOP_TimeCompare.C, SOP/SOP_TimeCompare.h, standalone/geo2voxel.C, standalone/i3ddsmgen.C, standalone/tiledevice.C, standalone/traverse.C, VOP/VOP_CustomContext.C, VOP/VOP_CustomContext.h, VOP/VOP_Switch.C, and VOP/VOP_Switch.h.

Definition at line 73 of file UT_String.h.

Member Enumeration Documentation

UT_String can be constructed with UT_String::ALWAYS_DEEP to create an object that will always perform deep copies when assigned to.

Enumerator
ALWAYS_DEEP 

Definition at line 79 of file UT_String.h.

Constructor & Destructor Documentation

SYS_FORCE_INLINE UT_String::UT_String ( const char *  str = 0)
inline

Construct UT_String from a C string, using shallow semantics.

Parameters
strThe initial string.

Definition at line 85 of file UT_String.h.

UT_String::UT_String ( const char *  str,
bool  deep_copy,
int  len = -1 
)

Construct UT_String from a C string, using shallow semantics.

Parameters
strThe initial string.
deep_copyIf true, a copy of str will be used.
lenNumber of characters to use from str. Use -1 to use the entire string. If len is non-negative, then deepCopy will be implicitly set to true. If str is NULL and len is non-negative, then it will be initialized with "".
UT_String::UT_String ( const std::string str)
inlineexplicit

Construct UT_String from a std::string, always doing a deep copy. The result will only be a UT_AlwaysDeep if the appropriate version is used, however!

NOTE: You cannot do: UT_String foo; std::string bar = "hello world"; foo = UT_String(bar.substr(2, 5));

It provides an shortcut for constructing a UT_String from a function that returns a std::string by value. For example, it lets you write

UT_String str(func());

instead of

UT_String str(func().c_str(), /*harden=*/true);

Definition at line 120 of file UT_String.h.

UT_String::UT_String ( const UT_StringHolder str)
inlineexplicit

Construct UT_String from a UT_StringHolder. This always duplicates and uses ALWAYS_DEEP semantics.

Definition at line 1435 of file UT_String.h.

UT_String::UT_String ( UT_StringHolder &&  str)
inlineexplicit

Construct UT_String from a UT_StringHolder rvalue with ALWAYS_DEEP semantics.

Definition at line 1444 of file UT_String.h.

UT_String::UT_String ( const UT_StringView sv)
explicit

Construct UT_String from a UT_StringView. This always duplicates and uses ALWAYS_DEEP semantics.

UT_String::UT_String ( UT_AlwaysDeepType  ,
const char *  str = 0 
)
inline

Construct UT_String from a C string, using ALWAYS_DEEP semantics.

Definition at line 146 of file UT_String.h.

UT_String::UT_String ( UT_AlwaysDeepType  ,
const std::string str 
)
inline

Construct UT_String from a std::string, using ALWAYS_DEEP semantics.

Definition at line 153 of file UT_String.h.

UT_String::UT_String ( const UT_String str)

Copy constructor

If the string we're copying from is ALWAYS_DEEP, then this object will also become ALWAYS_DEEP. This way, you can pass/return a string by value.

SYS_FORCE_INLINE UT_String::~UT_String ( )

Definition at line 1461 of file UT_String.h.

UT_String::UT_String ( UT_String &&  str)
inlinenoexcept

Move operators

Definition at line 169 of file UT_String.h.

Member Function Documentation

void UT_String::adopt ( char *  s)
inline

Take ownership of given string

adopt() is the opposite of steal(). Basically, you're giving the UT_String ownership of the string.

Definition at line 277 of file UT_String.h.

void UT_String::adopt ( UT_String str)
inline

Take ownership of given string

adopt() is the opposite of steal(). Basically, you're giving the UT_String ownership of the string.

Definition at line 287 of file UT_String.h.

void UT_String::adopt ( UT_StringHolder holder)

Take ownership of given string

adopt() is the opposite of steal(). Basically, you're giving the UT_String ownership of the string.

void UT_String::append ( char  ch)

Append a character.

void UT_String::append ( const char *  str,
exint  len = -1 
)

Append a string or a section of a string.

bool UT_String::applyCshModifiers ( const char *  modifiers)

Applies a "csh" style modifier string to this string. For example, a modifier string of ":e" would replace the string with the file extension of the string.

Returns true if any modifications were performed

const char* UT_String::base ( UT_String buf) const
const char* UT_String::buffer ( ) const
inline
const char* UT_String::c_str ( void  ) const
inline
Examples:
standalone/traverse.C.

Definition at line 508 of file UT_String.h.

int UT_String::changeQuotedWord ( const char *  from,
const char *  to,
int  quote = '`',
bool  all = true 
)
int UT_String::changeString ( const char *  from,
const char *  to,
bool  fullword 
)
int UT_String::changeWord ( const char *  from,
const char *  to,
bool  all = true 
)
void UT_String::clear ( void  )
inline

Reset the string to the default constructor.

Examples:
FS/FS_HomeHelper.C.

Definition at line 311 of file UT_String.h.

bool UT_String::collapseAbsolutePath ( bool  file_path = false)
int UT_String::compare ( const char *  str,
bool  case_sensitive = true 
) const
inline

Definition at line 382 of file UT_String.h.

int UT_String::compare ( const UT_String str,
bool  case_sensitive = true 
) const
inline

Definition at line 396 of file UT_String.h.

int UT_String::compare ( const UT_StringRef str,
bool  case_sensitive = true 
) const
static int UT_String::compareNumberedFilename ( const char *  s1,
const char *  s2,
bool  case_sensitive = false 
)
static
static int UT_String::compareNumberedString ( const char *  s1,
const char *  s2,
bool  case_sensitive = true,
bool  allow_negatives = false 
)
static
static int UT_String::compareNumberedStringWithExceptions ( const char *  s1,
const char *  s2,
bool  case_sensitive = false,
bool  allow_negatives = false,
const char *  sorted_first = nullptr,
const char *  sorted_last = nullptr 
)
static
static int UT_String::compareVersionString ( const char *  s1,
const char *  s2 
)
static

Compare two version strings which have numbered components separated by dots. eg. "X.Y.Z". Assumes the components go from most to least significant in left to right order.

bool UT_String::contains ( const char *  pattern,
bool  case_sensitive = true 
) const
int UT_String::count ( const char *  str,
bool  case_sensitive = true 
) const

Count the occurrences of the string.

int UT_String::countChar ( int  c) const

Return the number of occurrences of the specified character.

static int UT_String::countCshModifiers ( const char *  src)
static

Count the number of valid characters in the : modifier for variable expansion. For example, the string ":r" will return 2, the string ":r:t" will return 4, the string ":z" will return 0. These use the csh expansion modifiers.

If the string doesn't start with a ':', the method will return 0.

int UT_String::cshParse ( char *  argv[],
int  max_args,
void(*)(const char *, UT_String &)  vlookup = UTvarLookup,
void(*)(const char *, UT_String &)  elookup = UTexprLookup,
int error = 0,
UT_StringCshIO io = 0 
)
int UT_String::cshParse ( UT_WorkArgs argv,
void(*)(const char *, UT_String &)  vlookup = UTvarLookup,
void(*)(const char *, UT_String &)  elookup = UTexprLookup,
int error = 0,
UT_StringCshIO io = 0 
)
const char* UT_String::data ( ) const
inline

Definition at line 510 of file UT_String.h.

int UT_String::distance ( const char *  str,
bool  case_sensitive = true,
bool  allow_subst = true 
) const

Return the edit distance between two strings. See http://en.wikipedia.org/wiki/Levenshtein_distance for details. allow_subst controls whether a substitution of a character with another is a single operation, rather than two operations of insert and delete.

int UT_String::dosParse ( UT_WorkArgs argv,
bool  preserve_backslashes = false 
)
int UT_String::dosParse ( char *  argv[],
int  max_args,
bool  preserve_backslashes = false 
)
static int UT_String::dosParse ( char *  buffer,
UT_WorkArgs args,
bool  preserve_backslashes 
)
static

Perform dos parsing modifying the buffer passed in. The args will be stored as raw pointers into the given buffer

bool UT_String::endsWith ( const UT_StringView suffix,
bool  case_sensitive = true 
) const
bool UT_String::equal ( const char *  str,
bool  case_sensitive = true 
) const
inline

Definition at line 402 of file UT_String.h.

bool UT_String::equal ( const UT_String str,
bool  case_sensitive = true 
) const
inline

Definition at line 406 of file UT_String.h.

bool UT_String::equal ( const UT_StringRef str,
bool  case_sensitive = true 
) const
inline

Definition at line 410 of file UT_String.h.

int UT_String::erase ( int  pos = 0,
int  len = -1 
)
inline

Definition at line 1096 of file UT_String.h.

int UT_String::eraseHead ( int  len)
inline

Definition at line 1088 of file UT_String.h.

int UT_String::eraseTail ( int  len)
inline

Definition at line 1092 of file UT_String.h.

int UT_String::expandArrays ( char *  names[],
int  max 
)
int UT_String::expandArrays ( UT_StringArray tokens,
UT_StringArray names 
)

expandArrays will expand a series of tokens of the form prefix[pattern]suffix into the names UT_StringArray

Parameters
tokensis will store the parsed tokens without expansion
namesis will store the parsed tokens with expansion This doesn't need a max argument like: int expandArrays(char *names[], int max)
void UT_String::expandControlSequences ( bool  expand_extended = false)

Expands standard control sequences ('\n', '\r', '\t', '\0') to their corresponding ASCII values (10, 13, 9, 0, respectively). If the expand_extended flag is enabled, an extended expansion is enabled which adds hexadecimal, decimal and Unicode control sequence expansion. Any values resulting from that expansion, which are outside the standard ASCII range, will be encoded as UTF8-encoded control points.

void UT_String::expandVariables ( )
void UT_String::extractProgramName ( const char *  path,
bool  strip_extension = true,
bool  normalize_path = true 
)

Given a path, set the value of the string to the program name. For example:

str.extractProgramName(argv[0]);
str.extractProgramName("c:/Path/program.exe");
str.extractProgramName("/usr/bin/program");

This will extract the last path component. Program names may also have their extensions stripped. For example ".exe" on Windows and "-bin" to strip the Houdini wrappers on other platforms.

Note
The path should be normalized to have forward slashes as the path separator.
const char* UT_String::fcontain ( const char *  pattern,
bool  case_sensitive = true 
) const
inline

Definition at line 997 of file UT_String.h.

char* UT_String::fileExtension ( )
inline

Return the extension of a file path string

Examples:
field3d/f3d_io.C, and standalone/geo2voxel.C.

Definition at line 640 of file UT_String.h.

const char* UT_String::fileExtension ( ) const
inline

Return the extension of a file path string

Definition at line 647 of file UT_String.h.

const char* UT_String::fileName ( ) const
inline

Return last component of forward slash separated path string

If there is a slash in the string, fileName() returns the string starting after the slash. Otherwise, it returns the contents of this string. Note that it returns a pointer into this string.

Definition at line 633 of file UT_String.h.

char* UT_String::findChar ( int  c)
inline

Find first occurrance of character. Returns NULL upon failure.

Definition at line 558 of file UT_String.h.

const char* UT_String::findChar ( int  c) const
inline

Find first occurrance of character. Returns NULL upon failure.

Definition at line 560 of file UT_String.h.

char* UT_String::findChar ( const char *  str)
inline

Find first occurrance of any character in str

Definition at line 566 of file UT_String.h.

const char* UT_String::findChar ( const char *  str) const
inline

Find first occurrance of any character in str

Definition at line 568 of file UT_String.h.

static int UT_String::findLongestCommonPathPrefix ( const char *  fullpath1,
int  len1,
const char *  fullpath2,
int  len2 
)
static
int UT_String::findLongestCommonSuffix ( const char *  with) const
char* UT_String::findNonSpace ( )
const char* UT_String::findNonSpace ( ) const
bool UT_String::findString ( const char *  str,
bool  fullword,
bool  usewildcards 
) const
const char* UT_String::findWord ( const char *  word) const
bool UT_String::forceAlphaNumeric ( )
int int UT_String::forceValidVariableName ( const char *  safechars = NULL)
int UT_String::format ( int  cols)
void UT_String::formatByteSize ( exint  size,
int  digits = 2 
)

This will format a value to represent a given size in bytes, kilobytes, megabytes, etc.

Examples:
OPUI/OPUI_MemUsageTextBadge.C.
void UT_String::getAsCodePoints ( UT_Int32Array cp_list) const

Returns a list of Unicode code points from this string.

int UT_String::getCodePointCount ( ) const

Returns the number of Unicode codepoints in the string, assuming it's encoded as UTF-8.

static const UT_String& UT_String::getEmptyString ( )
static
int64 UT_String::getMemoryUsage ( bool  inclusive = true) const
inline

Return memory usage in bytes.

Definition at line 550 of file UT_String.h.

void UT_String::getRelativePath ( const char *  src_fullpath,
const char *  dest_fullpath,
bool  file_path = false 
)
void UT_String::harden ( const char *  s,
int  len = -1 
)

Take shallow copy and make it deep.

void UT_String::hardenIfNeeded ( )
inline

Take shallow copy and make it deep.

Definition at line 224 of file UT_String.h.

void UT_String::hardenIfNeeded ( const char *  s)
inline

Take shallow copy and make it deep.

Definition at line 234 of file UT_String.h.

SYS_FORCE_INLINE uint32 UT_String::hash ( void  ) const
inline

Definition at line 892 of file UT_String.h.

static SYS_FORCE_INLINE uint32 UT_String::hash ( const char *  str,
uint32  code = 0 
)
inlinestatic

Definition at line 900 of file UT_String.h.

bool UT_String::hasWhiteSpace ( ) const
void UT_String::incrementNumberedName ( bool  preserve_padding = false)
int UT_String::insert ( int  pos,
const char *  str 
)
inline

Definition at line 1104 of file UT_String.h.

bool UT_String::isAbsolutePath ( bool  file_path = false) const
bool UT_String::isAlwaysDeep ( ) const
inline

Definition at line 206 of file UT_String.h.

bool UT_String::isFloat ( bool  skip_spaces = false,
bool  loose = false,
bool  allow_underscore = false 
) const

Determine if string can be seen as a single floating point number.

bool UT_String::isHard ( ) const
inline

Returns whether this string is hardened already.

Definition at line 244 of file UT_String.h.

bool UT_String::isInteger ( bool  skip_spaces = false) const

Determine if string can be seen as a single integer number.

bool UT_String::isQuotedString ( char  delimiter = '\'') const

returns true if the string begins and ends with a (non-escaped) quote 'delimiter'.

bool UT_String::isValidVariableName ( const char *  safechars = NULL) const
static int UT_String::itoa ( char *  str,
int64  i 
)
static
void UT_String::itoa ( int64  i)
void UT_String::itoaPretty ( int64  val)
char* UT_String::lastChar ( int  c)
inline

Find last occurance of character

Definition at line 574 of file UT_String.h.

const char* UT_String::lastChar ( int  c) const
inline

Find last occurance of character

Definition at line 576 of file UT_String.h.

unsigned UT_String::length ( void  ) const
inline

Return length of string.

Examples:
FS/FS_HomeHelper.C.

Definition at line 546 of file UT_String.h.

bool UT_String::load ( UT_IStream is)

Load string from stream. Use is.eof() to check eof status.

Examples:
SOP/SOP_BlindData.C.
UT_String UT_String::makeQuotedString ( char  delimiter = '\'',
bool  escape_nonprinting = false 
) const

makeQuotedString() is similar to protectString() except it returns a new string instead of changing this string, it does wrap the string in quotes, and it lets you use either ' or " as the delimiter. The quoted string can also be optionally be made to escape non-printing characters. The string that's returned is UT_String::ALWAYS_DEEP.

UT_String UT_String::makeSmartQuotedString ( char  default_delimiter = '\'',
bool  escape_nonprinting = false 
) const

makeSmartQuotedString() will use either ' or " as the delimiter to avoid escaped quotes, using the default delimiter if it doesn't matter. The quoted string can also be optionally be made to escape non-printing characters. The string that's returned is UT_String::ALWAYS_DEEP.

bool UT_String::match ( const char *  pattern,
bool  case_sensitive = true 
) const
bool UT_String::matchFile ( const char *  pattern) const
bool UT_String::matchFileExtension ( const char *  match_extension) const
inline

Return whether the file extension matches. The extension passed in should include the '.' separator. For example:

Definition at line 657 of file UT_String.h.

bool UT_String::matchPath ( const char *  pattern,
bool  case_sensitive = true,
bool *  excludes_branch = nullptr 
) const
bool UT_String::matchPattern ( const UT_WorkArgs pattern_args,
bool  assume_match = false 
) const

matchPattern(UT_WorkArgs &) assumes that the arguments contain the components of a pattern to be matched against. The method returns true if the pattern matches, false if it doesn't. This matching process handles ^ expansion properly (and efficiently). If the string doesn't match any components of the pattern, then the assumed value is returned.

static bool UT_String::matchProgramName ( const char *  path,
const char *  expected,
bool  normalize_path = false 
)
static

Given a path, check to see whether the program name matches the expected. For example:

if (UT_String::matchProgramname(argv[0], "houdini"))
if (UT_String::matchProgramname("c:/Path/houdini.exe", "houdini"))
if (UT_String::matchProgramname("/usr/bin/houdini", "houdini"))

The matching is always case-insensitive.

Note
The path should be normalized to have forward slashes as the path separator.
bool UT_String::multiMatch ( const char *  pattern,
bool  case_sensitive,
char  separator 
) const
bool UT_String::multiMatch ( const char *  pattern,
bool  case_sensitive = true,
const char *  separators = ", ",
bool *  explicitly_excluded = 0,
int match_index = 0,
ut_PatternRecord *  pattern_record = NULL 
) const
bool UT_String::multiMatch ( const UT_StringMMPattern pattern,
bool *  explicitly_excluded = 0,
int match_index = 0,
ut_PatternRecord *  pattern_record = NULL 
) const
static bool UT_String::multiMatchCheck ( const char *  pattern)
static
bool UT_String::multiMatchRecord ( const char *  pattern,
int  maxpatterns,
char *  singles,
int nsingles,
char **  words,
int nwords,
bool  case_sensitive = true,
const char *  separators = ", " 
) const
bool UT_String::multiMatchRecord ( const UT_StringMMPattern pattern,
int  maxpatterns,
char *  singles,
int nsingles,
char **  words,
int nwords 
) const
bool UT_String::multiMatchRecord ( const char *  pattern,
UT_StringHolder singles,
UT_StringArray words,
bool  case_sensitive = true,
const char *  separators = ", " 
) const
const char* UT_String::nonNullBuffer ( ) const
inline

Definition at line 511 of file UT_String.h.

void UT_String::normalizePath ( )

Convert a path to a "normalized" path. That is, all back-slashes will be converted to forward slashes. On some operating systems, this will leave the string unchanged.

SYS_SAFE_BOOL UT_String::operator bool ( ) const
inline

Test whether the string is defined or not.

Definition at line 489 of file UT_String.h.

UT_String::operator char * ( )
inline

Definition at line 502 of file UT_String.h.

UT_String::operator const char * ( ) const
inline

Definition at line 500 of file UT_String.h.

UT_String::operator UT_StringView ( ) const
inline

Definition at line 505 of file UT_String.h.

bool UT_String::operator!= ( const char *  str) const
inline

Definition at line 427 of file UT_String.h.

bool UT_String::operator!= ( const UT_String str) const
inline

Definition at line 431 of file UT_String.h.

bool UT_String::operator!= ( const UT_StringRef str) const
inline

Definition at line 435 of file UT_String.h.

char UT_String::operator() ( unsigned  i) const
inline

Definition at line 513 of file UT_String.h.

char& UT_String::operator() ( unsigned  i)
inline

Definition at line 520 of file UT_String.h.

UT_String& UT_String::operator+= ( const char *  str)
inline

Definition at line 342 of file UT_String.h.

UT_String& UT_String::operator+= ( const UT_String str)
inline

Definition at line 374 of file UT_String.h.

UT_String& UT_String::operator+= ( const UT_StringRef str)
bool UT_String::operator< ( const char *  str) const
inline

Definition at line 439 of file UT_String.h.

bool UT_String::operator< ( const UT_String str) const
inline

Definition at line 443 of file UT_String.h.

bool UT_String::operator< ( const UT_StringRef str) const
inline

Definition at line 447 of file UT_String.h.

bool UT_String::operator<= ( const char *  str) const
inline

Definition at line 451 of file UT_String.h.

bool UT_String::operator<= ( const UT_String str) const
inline

Definition at line 455 of file UT_String.h.

bool UT_String::operator<= ( const UT_StringRef str) const
inline

Definition at line 459 of file UT_String.h.

UT_String& UT_String::operator= ( UT_String &&  str)
inline

Move operators

Definition at line 177 of file UT_String.h.

UT_String& UT_String::operator= ( const UT_String str)
UT_String& UT_String::operator= ( const char *  str)
UT_String& UT_String::operator= ( const std::string str)
UT_String& UT_String::operator= ( const UT_StringHolder str)
UT_String & UT_String::operator= ( UT_StringHolder &&  str)
inline

Definition at line 1453 of file UT_String.h.

UT_String& UT_String::operator= ( const UT_StringView str)
bool UT_String::operator== ( const char *  str) const
inline

Definition at line 415 of file UT_String.h.

bool UT_String::operator== ( const UT_String str) const
inline

Definition at line 419 of file UT_String.h.

bool UT_String::operator== ( const UT_StringRef str) const
inline

Definition at line 423 of file UT_String.h.

bool UT_String::operator> ( const char *  str) const
inline

Definition at line 463 of file UT_String.h.

bool UT_String::operator> ( const UT_String str) const
inline

Definition at line 467 of file UT_String.h.

bool UT_String::operator> ( const UT_StringRef str) const
inline

Definition at line 471 of file UT_String.h.

bool UT_String::operator>= ( const char *  str) const
inline

Definition at line 475 of file UT_String.h.

bool UT_String::operator>= ( const UT_String str) const
inline

Definition at line 479 of file UT_String.h.

bool UT_String::operator>= ( const UT_StringRef str) const
inline

Definition at line 483 of file UT_String.h.

int UT_String::parse ( char *  argv[],
int  max_args,
const char *  quotes = "\"'",
bool  keep_quotes = false 
)
inline
Examples:
SOP/SOP_PrimVOP.C.

Definition at line 803 of file UT_String.h.

int UT_String::parse ( UT_WorkArgs argv,
int  start_arg = 0,
const char *  quotes = "\"'",
bool  keep_quotes = false 
)
inline

Definition at line 809 of file UT_String.h.

int UT_String::parse ( UT_StringArray argv,
int  start_arg = 0,
const char *  quotes = "\"'",
bool  keep_quotes = false 
)
inline

Definition at line 815 of file UT_String.h.

int UT_String::parseInPlace ( char *  argv[],
int  max_args,
const char *  quotes = "\"'",
bool  keep_quotes = false 
)
int UT_String::parseInPlace ( UT_WorkArgs argv,
int  start_arg = 0,
const char *  quotes = "\"'",
bool  keep_quotes = false 
)
int UT_String::parseInPlace ( UT_StringArray argv,
int  start_arg = 0,
const char *  quotes = "\"'",
bool  keep_quotes = false 
)
int UT_String::parseNumberedFilename ( UT_String prefix,
UT_String frame,
UT_String suff,
bool  negative = true,
bool  fractional = false 
) const

Decompose a filename into various parts

parseNumberedFileName will breakup a filename into its various parts: file = prefix$Fsuffix (note: suffix is not the same as file extension.) 0 is returned if there is no frame number. 'negative' allows -[frame] to be interpreted as a negative number. 'fractional' allows [frame].[number] to be interpreted as a fractional frame.

UT_String UT_String::pathUpToExtension ( ) const

Return path terminated just before the extension. If the filename starts with '.' and no path is provided, returns NULL

Examples:
field3d/f3d_io.C.
bool UT_String::patternRename ( const char *  match_pattern,
const char *  replace 
)
void UT_String::pluralize ( )

Pluralize an English noun ending (i.e. box->boxes or tube->tubes). The ending must be lower case to be processed properly.

void UT_String::prepend ( const char *  prefix)

Prepend a string (or character)

void UT_String::prepend ( char  ch)

Prepend a string (or character)

void UT_String::protectPreQuotePythonStringLiteral ( char  delimiter = '\'')

protectPreQuotePythonStringLiteral() will modify the existing string

specified delimiter. Unlike protectString(), it will not wrap the string in quotes.

void UT_String::protectString ( bool  protect_empty = false)

protectString() will modify the existing string to escape double quotes and backslashes. It will only wrap the string in double quotes if it has spaces in it. If 'protect_empty' is true, the string will become '""', otherwise it will stay empty.

static void UT_String::protectString ( std::ostream &  os,
char  c 
)
static

If the char is a quote character " or ' then make sure to protect it by adding '\' before the quote character. If the character is not a quote character then the character is simply added to the ostream.

static int UT_String::qsortCmpNumberedFilename ( const char *const v1,
const char *const v2 
)
static
static int UT_String::qsortCmpNumberedString ( const char *const v1,
const char *const v2 
)
static
void UT_String::removeLast ( )
inline

Remove the last character.

Definition at line 327 of file UT_String.h.

UT_String UT_String::removeRange ( )

This will remove the range from a string of the form foo$Fbar.ext (#-#) and return the first number from the range. If there is only 1 range number, it will be returned. If there is no range, 0 is returned. The returned string is hardened.

void UT_String::removeTrailingChars ( char  chr)
void UT_String::removeTrailingDigits ( )
void UT_String::removeTrailingSpace ( )
int UT_String::replace ( int  pos,
int  len,
const char *  str 
)
UT_String UT_String::replaceExtension ( const UT_String new_ext) const

Replace the file extension and return the new string.

int UT_String::replacePrefix ( const char *  oldpref,
const char *  newpref 
)
int UT_String::replaceSuffix ( const char *  oldsuffix,
const char *  newsuffix 
)
void UT_String::save ( std::ostream &  os,
bool  binary 
) const

Save string to stream. Saves as binary if binary is true.

Examples:
SOP/SOP_BlindData.C.
void UT_String::save ( UT_OStream os,
bool  binary 
) const
void UT_String::saveAscii ( std::ostream &  os) const
inline

Save string to ASCII stream. This will add double quotes and escape to the stream if necessary (empty string or contains spaces).

Definition at line 300 of file UT_String.h.

void UT_String::saveAscii ( UT_OStream os) const
inline

Definition at line 301 of file UT_String.h.

void UT_String::saveBinary ( std::ostream &  os) const
inline

Save string to binary stream.

Definition at line 296 of file UT_String.h.

void UT_String::setAlwaysDeep ( bool  deep)
inline

Make a string always deep.

Definition at line 190 of file UT_String.h.

static std::ostream& UT_String::setFormat ( std::ostream &  os,
const char *  fmt 
)
static
std::ostream& UT_String::setFormat ( std::ostream &  os)
void UT_String::splitPath ( UT_String dir_name,
UT_String file_name 
) const

Split a path into dir_name and file_name, where file_name is everything after the final slash (i.e. the same as fileName()). Either part may be empty. Note that if the string starts with / and only contains that one slash, the dir_name will be / and not blank. dir_name and file_name will either be set to hardened strings or an empty string.

int UT_String::sprintf ( const char *  fmt,
  ... 
)
bool UT_String::startsWith ( const UT_StringView prefix,
bool  case_sensitive = true 
) const
char* UT_String::steal ( )
inline

Give up ownership of string

Take a hard reference and make it shallow. This method makes sure it gives back something you can delete, because this UT_String is taking its hands off the data. Use it with care since it may lead to memory leaks if, for example, you harden it again later.

In the case of ALWAYS_DEEP strings, this is disallowed so it will just return a copy of the data.

Definition at line 255 of file UT_String.h.

int UT_String::strip ( const char *  chars)

strips out all characters found in 'chars'. The string length will be reduced by the number of characters removed. The number of characters removed is returned.

int UT_String::substitute ( const char *  find,
const char *  replacement,
int  count = -1 
)

Replaces up to 'count' occurrences of 'find' with 'replacement', and returns the number of substitutions that occurred. If 'count' <= 0, all occurrences will be replaced.

int UT_String::substitute ( const char *  find,
const char *  replacement,
bool  all 
)
inline

Convenience version of substitute() for all or single occurrence.

Definition at line 1076 of file UT_String.h.

int UT_String::substitute ( char  find,
char  replacement,
bool  all = true 
)
int UT_String::substr ( UT_String buf,
int  index,
int  len = 0 
) const

Perform deep copy of the substring starting from index for len characters into the specified UT_String. If len is too long, then a substring starting from index to the end of the string is copied. Returns the length of the copied substring.

const char* UT_String::suffix ( ) const
void UT_String::swap ( UT_String other)
inline

Definition at line 1480 of file UT_String.h.

void UT_String::timeDeltaToPrettyString ( double  time_ms)

Convert the given time delta (in milliseconds) to a reader-friendly string in days, hours, minutes, and seconds.

void UT_String::timeDeltaToPrettyStringMS ( double  time_ms)

Convert the given time delta (in milliseconds) to a reader-friendly string in milliseconds.

fpreal UT_String::toFloat ( ) const
int UT_String::toInt ( ) const
int UT_String::tokenize ( char *  argv[],
int  max_args,
char  separator 
)
inline
Examples:
FS/FS_HomeHelper.C, and standalone/i3ddsmgen.C.

Definition at line 832 of file UT_String.h.

int UT_String::tokenize ( UT_WorkArgs argv,
char  separator 
)
inline

Definition at line 838 of file UT_String.h.

int UT_String::tokenize ( char *  argv[],
int  max_args,
const char *  separators = " \t\n" 
)
inline

Definition at line 844 of file UT_String.h.

int UT_String::tokenize ( UT_WorkArgs argv,
const char *  separators = " \t\n" 
)
inline

Definition at line 852 of file UT_String.h.

template<typename T >
int UT_String::tokenize ( T list,
const char *  separators = " \t\n" 
)
inline

Definition at line 861 of file UT_String.h.

int UT_String::tokenizeInPlace ( char *  argv[],
int  max_args,
char  separator 
)
int UT_String::tokenizeInPlace ( UT_WorkArgs argv,
char  separator 
)
int UT_String::tokenizeInPlace ( char *  argv[],
int  max_args,
const char *  separators = " \t\n" 
)
int UT_String::tokenizeInPlace ( UT_WorkArgs argv,
const char *  separators = " \t\n" 
)
template<typename T >
int UT_String::tokenizeInPlace ( T list,
const char *  separators = " \t\n" 
)
inline

Definition at line 868 of file UT_String.h.

void UT_String::toLower ( )
inline

Definition at line 619 of file UT_String.h.

std::string UT_String::toStdString ( ) const

Converts the contents of this UT_String to a std::string. Note that std::string can't be constructed with a null pointer, so you can't just write std::string s = ut_string.buffer();

void UT_String::toUpper ( )
inline

Definition at line 612 of file UT_String.h.

int UT_String::traversePattern ( int  max,
void data,
int(*)(int num, int sec, void *data func,
unsigned int(*)(int num, void *data secfunc = 0,
int  offset = 0 
) const
int UT_String::trimBoundingSpace ( )

A version of trimSpace() that only removes leading and following spaces from a string, leaving any between words intact.

int UT_String::trimSpace ( bool  leave_single_space_between_words = false)

trimSpace() will remove all space characters (leading and following) from a string. If the string consists of multiple words, the words will be collapsed. The function returns 1 if space was trimmed.

void UT_String::truncate ( exint  len)

Truncate the string at the Nth character.

bool UT_String::truncateMiddle ( int  max_length)
static int UT_String::utoa ( char *  str,
uint64  i 
)
static
void UT_String::utoa ( uint64  i)
static bool UT_String::wildcardMatchCheck ( const char *  pattern)
static
void UT_String::write ( unsigned  i,
char  c 
)
inline

Definition at line 527 of file UT_String.h.

Friends And Related Function Documentation

UT_API std::ostream& operator<< ( std::ostream &  os,
const UT_String d 
)
friend

This operator saves the string to the stream via the string's saveAscii() method, protecting any whitespace (by adding quotes), backslashes or quotes in the string.

UT_API UT_OStream& operator<< ( UT_OStream os,
const UT_String d 
)
friend
void swap ( UT_String a,
UT_String b 
)
friend

Friend specialization of std::swap() to use UT_String::swap()

Definition at line 1302 of file UT_String.h.

friend class UT_API UT_StringRef
friend

Definition at line 1360 of file UT_String.h.


The documentation for this class was generated from the following file: