This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
ofUtils.h
Go to the documentation of this file.
396std::vector<std::string> ofSplitString(const std::string& source, const std::string& delimiter, bool ignoreEmpty = false, bool trim = false);
401std::string ofJoinString(const std::vector<std::string>& stringElements, const std::string& delimiter);
408void ofStringReplace(std::string& input, const std::string& searchStr, const std::string& replaceStr);
530OF_DEPRECATED_MSG("Use ofUTF8Append instead", void ofAppendUTF8(std::string & str, uint32_t utf8));
707 out << std::fixed << std::setfill(fill) << std::setw(width) << std::setprecision(precision) << value;
Iterate through each Unicode codepoint in a UTF8-encoded std::string.
Definition ofUtils.h:1114
utf8::iterator< std::string::const_iterator > begin() const
Definition ofUtils.cpp:723
utf8::iterator< std::string::const_iterator > end() const
Definition ofUtils.cpp:732
utf8::iterator< std::string::const_reverse_iterator > rend() const
Definition ofUtils.cpp:750
utf8::iterator< std::string::const_reverse_iterator > rbegin() const
Definition ofUtils.cpp:741
void shuffle(T &values)
Shuffles the order of the elements within the passed container, using the centralized random engine.
Definition ofRandomEngine.h:68
Definition ofEvents.cpp:625
ofTargetPlatform
This enumerates the targeted operating systems or platforms.
Definition ofConstants.h:31
std::string ofGetVersionPreRelease()
Get the pre-release version of openFrameworks.
Definition ofUtils.cpp:998
std::string ofSystem(const std::string &command)
Executes a system command. Similar to run a command in terminal.
std::vector< std::string > ofSplitString(const std::string &source, const std::string &delimiter, bool ignoreEmpty=false, bool trim=false)
Splits a string using a delimiter.
size_t ofUTF8Length(const std::string &utf8)
Get the number of Unicode code points in a UTF8-encoded string.
Definition ofUtils.cpp:898
uint64_t ofGetSystemTimeMillis()
Get the system time in milliseconds (system uptime).
Definition ofUtils.cpp:326
std::string ofVAArgsToString(const char *format, Args &&... args)
Convert a variable length argument to a string.
Definition ofUtils.h:619
float ofHexToFloat(const std::string &floatHexString)
Convert a string representing an float in hexadecimal to a float.
void ofUTF8Append(std::string &utf8, uint32_t codepoint)
Append a Unicode codepoint to a UTF8-encoded std::string.
std::string ofJoinString(const std::vector< std::string > &stringElements, const std::string &delimiter)
Join a vector of strings together into one string.
std::string ofToHex(const T &value)
Converts any value to its equivalent hexadecimal representation.
Definition ofUtils.h:833
uint64_t ofGetElapsedTimeMillis()
Get the elapsed time in milliseconds.
Definition ofUtils.cpp:301
std::string ofToBinary(const T &value)
Converts any datatype value to a string of only 1s and 0s.
Definition ofUtils.h:922
uint64_t ofGetElapsedTimeMicros()
Get the elapsed time in microseconds.
Definition ofUtils.cpp:306
uint64_t ofGetUnixTime()
Get the number of seconds since Midnight, January 1, 1970.
Definition ofUtils.cpp:336
void ofUTF8Insert(std::string &utf8, size_t pos, uint32_t codepoint)
Insert a Unicode codepoint into a UTF8-encoded string at a position.
int ofHexToInt(const std::string &intHexString)
Convert a string representing an integer in hexadecimal to a string.
void ofRandomize(std::vector< T > &values)
Randomly reorder the values in a vector.
Definition ofUtils.h:241
std::size_t ofStringTimesInString(const std::string &haystack, const std::string &needle)
Check how many times a string contains another string.
void ofSort(std::vector< T > &values)
Sort a vector of values into ascending order.
Definition ofUtils.h:298
std::string ofGetEnv(const std::string &var, const std::string defaultValue="")
Get the value of a given environment variable.
Definition ofUtils.cpp:1105
void ofSleepMillis(int millis)
Sleeps the current thread for the specified amount of milliseconds.
Definition ofUtils.cpp:346
bool ofContains(const std::vector< T > &values, const T &target)
Search for a target value in a vector of values.
Definition ofUtils.h:364
void ofRemove(std::vector< T > &values, BoolFunction shouldErase)
Conditionally remove values from a vector.
Definition ofUtils.h:284
char ofToChar(const std::string &charString)
Convert a string representation of a char to a actual char.
unsigned int ofGetVersionMajor()
Get the major version number of openFrameworks.
Definition ofUtils.cpp:986
std::string ofGetVersionInfo()
Get the current version of openFrameworks as a string.
Definition ofUtils.cpp:974
void ofSaveScreen(const std::string &filename)
Saves the current screen image to a file on disk.
void ofLaunchBrowser(const std::string &url, bool uriEncodeQuery=false)
Launch the given URL in the default browser.
void ofStringReplace(std::string &input, const std::string &searchStr, const std::string &replaceStr)
Replace all occurrences of a string with another string.
bool ofIsStringInString(const std::string &haystack, const std::string &needle)
Check if string contains another string.
void ofUTF8Erase(std::string &utf8, size_t pos, size_t len)
Erase a range of codepoints from a UTF8-encoded substring.
uint64_t ofGetFrameNum()
Get the number of frames rendered since the program started.
Definition ofEvents.cpp:50
std::string ofBinaryToString(const std::string &value)
Convert a binary string to ASCII characters.
uint64_t ofGetSystemTimeMicros()
Get the system time in microseconds (system uptime).
Definition ofUtils.cpp:331
std::string ofToUpper(const std::string &src, const std::string &locale="")
Converts all characters in the string to uppercase.
std::string ofUTF8ToString(uint32_t codepoint)
Convert a Unicode codepoint to a UTF8-encoded std::string.
Definition ofUtils.cpp:891
T ofFromString(const std::string &value)
Convert a string represetnation to another type.
Definition ofUtils.h:742
std::string ofUTF8Substring(const std::string &utf8, size_t pos, size_t len)
Extract a range of codepoints from as a std::string.
void ofSaveFrame(bool bUseViewport=false)
Saves the current frame as a PNG image.
Definition ofUtils.cpp:1033
unsigned int ofGetVersionMinor()
Get the minor version number of openFrameworks.
Definition ofUtils.cpp:990
std::string ofTrimFront(const std::string &src, const std::string &locale="")
Remove locale-defined whitespace from the beginning of a string.
ofTargetPlatform ofGetTargetPlatform()
Get the target platform of the current system.
Definition ofUtils.cpp:1074
uint64_t ofGetUnixTimeMillis()
Get the Unix Time in milliseconds.
Definition ofUtils.cpp:340
std::size_t ofFind(const std::vector< T > &values, const T &target)
Search for a target value in a vector of values.
Definition ofUtils.h:354
void ofSaveViewport(const std::string &filename)
Saves the current viewport as an image.
std::string ofToString(const T &value)
Convert a value to a string.
Definition ofUtils.h:657
std::string ofTrim(const std::string &src, const std::string &locale="")
Remove locale-defined whitespace from the beginning and end of a string.
void ofShuffle(Args &&... args)
Randomly reorder the values in a container.
Definition ofUtils.h:231
unsigned int ofGetVersionPatch()
Get the patch version number of openFrameworks.
Definition ofUtils.cpp:994
std::string ofTrimBack(const std::string &src, const std::string &locale="")
Remove locale-defined whitespace from the end of a string.
std::string ofGetTimestampString()
Formats the current system time according to the given format.
Definition ofUtils.cpp:360
void ofResetElapsedTimeCounter()
Reset the elapsed time counter.
Definition ofUtils.cpp:316
char ofHexToChar(const std::string &charHexString)
Convert a string representing an char in hexadecimal to a char.
std::string ofToLower(const std::string &src, const std::string &locale="")
Converts all characters in a string to lowercase.
std::string ofHexToString(const std::string &stringHexString)
Convert a string representing an string in hexadecimal to a string.
float ofGetElapsedTimef()
Get the elapsed time in seconds.
Definition ofUtils.cpp:311
Definition ofUtils.h:101
std::chrono::time_point< std::chrono::nanoseconds > getAsTimePoint() const
Definition ofUtils.cpp:207
ofTime operator+(const std::chrono::duration< rep, ratio > &duration) const
Definition ofUtils.h:126
enum ofTime::Mode mode
ofTime & operator+=(const std::chrono::duration< rep, ratio > &duration)
Definition ofUtils.h:140