HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_StringUtils.h File Reference
#include "UT_API.h"
#include "UT_StringView.h"
#include <SYS/SYS_Compiler.h>
#include <SYS/SYS_Inline.h>
#include <SYS/SYS_ParseNumber.h>
#include <SYS/SYS_String.h>
#include <SYS/SYS_Types.h>
#include <tuple>
#include <string.h>
+ Include dependency graph for UT_StringUtils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

SYS_FORCE_INLINE bool UTisstring (const char *s)
 
template<typename T >
SYS_NO_DISCARD_RESULT bool UTstringStartsWith (const T &str, const char *prefix, bool case_sensitive=true, exint len=-1)
 
template<typename T >
SYS_NO_DISCARD_RESULT bool UTstringEndsWith (const T &str, const char *suffix, bool case_sensitive=true, exint len=-1)
 
template<typename T >
SYS_NO_DISCARD_RESULT const char * UTstringNumericSuffix (const T &str)
 
template<typename StringT >
SYS_NO_DISCARD_RESULT UT_StringView UTstringFileName (const StringT &str)
 
template<>
SYS_NO_DISCARD_RESULT UT_StringView UTstringFileName (const UT_StringView &str)
 
template<typename StringT >
SYS_NO_DISCARD_RESULT
std::tuple< UT_StringView,
UT_StringView, UT_StringView
UTstringSplitPath (const StringT &str)
 Split the given path into the directory, filename, and file extension. More...
 
template<>
SYS_NO_DISCARD_RESULT
std::tuple< UT_StringView,
UT_StringView, UT_StringView
UTstringSplitPath (const UT_StringView &str)
 Split the given path into the directory, filename, and file extension. More...
 
template<typename StringT >
SYS_NO_DISCARD_RESULT UT_StringView UTstringFileExtension (const StringT &str)
 
template<>
SYS_NO_DISCARD_RESULT UT_StringView UTstringFileExtension< UT_StringView > (const UT_StringView &str)
 
template<typename StringT >
SYS_NO_DISCARD_RESULT bool UTstringMatchFileExtension (const StringT &str, const char *extension)
 
template<typename StringT >
SYS_NO_DISCARD_RESULT int UTstringCountChar (const StringT &str, int c)
 
template<>
SYS_NO_DISCARD_RESULT int UTstringCountChar< UT_StringView > (const UT_StringView &str, int c)
 
template<typename StringT >
SYS_NO_DISCARD_RESULT bool UTstringIsFloat (const StringT &str, bool skip_spaces=false, bool loose=false, bool allow_underscore=false)
 
template<>
SYS_NO_DISCARD_RESULT bool UTstringIsFloat< UT_StringView > (const UT_StringView &str, bool skip_spaces, bool loose, bool allow_underscore)
 
template<typename StringT >
SYS_NO_DISCARD_RESULT bool UTstringIsInteger (const StringT &str, bool skip_spaces=false)
 
template<>
SYS_NO_DISCARD_RESULT bool UTstringIsInteger< UT_StringView > (const UT_StringView &str, bool skip_spaces)
 
template<typename StringT >
bool UTstringParseNumberedFilename (const StringT &str, UT_StringView &prefix, UT_StringView &frame, UT_StringView &suffix, bool negative, bool fractional)
 
template<typename StringT >
bool UTstringParseNumberedFilename (const StringT &str, UT_StringHolder &prefix, UT_StringHolder &frame, UT_StringHolder &suffix, bool negative, bool fractional)
 
template<typename StringT >
bool UTstringIsQuoted (const StringT &str, char delimiter)
 
template<typename StringT , typename IntT >
SYS_ParseStatus UTstringToInt (const StringT &str, IntT &number, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 
template<typename IntT , typename StringT >
SYS_NO_DISCARD_RESULT IntT UTstringToInt (const StringT &str, int base=0, SYS_ParseFlags flags=SYS_ParseFlags::None)
 

Function Documentation

SYS_FORCE_INLINE bool UTisstring ( const char *  s)
Examples:
FS/FS_HomeHelper.C, and SIM/GAS_NetVDBSliceExchange.C.

Definition at line 29 of file UT_StringUtils.h.

template<typename StringT >
SYS_NO_DISCARD_RESULT int UTstringCountChar ( const StringT &  str,
int  c 
)

Definition at line 205 of file UT_StringUtils.h.

Definition at line 213 of file UT_StringUtils.h.

template<typename T >
SYS_NO_DISCARD_RESULT bool UTstringEndsWith ( const T &  str,
const char *  suffix,
bool  case_sensitive = true,
exint  len = -1 
)

Definition at line 56 of file UT_StringUtils.h.

template<typename StringT >
SYS_NO_DISCARD_RESULT UT_StringView UTstringFileExtension ( const StringT &  str)

Definition at line 167 of file UT_StringUtils.h.

template<typename StringT >
SYS_NO_DISCARD_RESULT UT_StringView UTstringFileName ( const StringT &  str)

Definition at line 97 of file UT_StringUtils.h.

template<>
SYS_NO_DISCARD_RESULT UT_StringView UTstringFileName ( const UT_StringView str)
inline

Definition at line 106 of file UT_StringUtils.h.

template<typename StringT >
SYS_NO_DISCARD_RESULT bool UTstringIsFloat ( const StringT &  str,
bool  skip_spaces = false,
bool  loose = false,
bool  allow_underscore = false 
)

Definition at line 236 of file UT_StringUtils.h.

template<>
SYS_NO_DISCARD_RESULT bool UTstringIsFloat< UT_StringView > ( const UT_StringView str,
bool  skip_spaces,
bool  loose,
bool  allow_underscore 
)
inline

Definition at line 334 of file UT_StringUtils.h.

template<typename StringT >
SYS_NO_DISCARD_RESULT bool UTstringIsInteger ( const StringT &  str,
bool  skip_spaces = false 
)

Definition at line 347 of file UT_StringUtils.h.

template<>
SYS_NO_DISCARD_RESULT bool UTstringIsInteger< UT_StringView > ( const UT_StringView str,
bool  skip_spaces 
)
inline

Definition at line 384 of file UT_StringUtils.h.

template<typename StringT >
bool UTstringIsQuoted ( const StringT &  str,
char  delimiter 
)

Definition at line 484 of file UT_StringUtils.h.

template<typename StringT >
SYS_NO_DISCARD_RESULT bool UTstringMatchFileExtension ( const StringT &  str,
const char *  extension 
)

Definition at line 197 of file UT_StringUtils.h.

template<typename T >
SYS_NO_DISCARD_RESULT const char* UTstringNumericSuffix ( const T &  str)

Definition at line 79 of file UT_StringUtils.h.

template<typename StringT >
bool UTstringParseNumberedFilename ( const StringT &  str,
UT_StringView prefix,
UT_StringView frame,
UT_StringView suffix,
bool  negative,
bool  fractional 
)

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.

WARNING: Make sure to take care of lifetimes when the input string is UT_StringView.

Definition at line 404 of file UT_StringUtils.h.

template<typename StringT >
bool UTstringParseNumberedFilename ( const StringT &  str,
UT_StringHolder prefix,
UT_StringHolder frame,
UT_StringHolder suffix,
bool  negative,
bool  fractional 
)

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.

template<typename StringT >
SYS_NO_DISCARD_RESULT std::tuple<UT_StringView, UT_StringView, UT_StringView> UTstringSplitPath ( const StringT &  str)

Split the given path into the directory, filename, and file extension.

Definition at line 124 of file UT_StringUtils.h.

template<>
SYS_NO_DISCARD_RESULT std::tuple<UT_StringView, UT_StringView, UT_StringView> UTstringSplitPath ( const UT_StringView str)
inline

Split the given path into the directory, filename, and file extension.

Definition at line 134 of file UT_StringUtils.h.

template<typename T >
SYS_NO_DISCARD_RESULT bool UTstringStartsWith ( const T &  str,
const char *  prefix,
bool  case_sensitive = true,
exint  len = -1 
)

Definition at line 33 of file UT_StringUtils.h.

template<typename StringT , typename IntT >
SYS_ParseStatus UTstringToInt ( const StringT &  str,
IntT &  number,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Definition at line 495 of file UT_StringUtils.h.

template<typename IntT , typename StringT >
SYS_NO_DISCARD_RESULT IntT UTstringToInt ( const StringT &  str,
int  base = 0,
SYS_ParseFlags  flags = SYS_ParseFlags::None 
)

Definition at line 508 of file UT_StringUtils.h.