String class used by the mwArray
API
to pass string data as output from certain methods
The mwString
class is a simple string class
used by the mwArray
API to pass string data as
output from certain methods.
mclcppclass.h
mclmcrrt.h
Tip MATLAB® Compiler SDK™ automatically includes these header files in the header file generated for your MATLAB functions. |
Create an empty string.
Create a new string and initialize the string's data with the supplied char buffer.
char* str | Null terminated character buffer |
Create a new string and initialize the string's data with the contents of the supplied string.
mwString& str | Initialized mwString instance |
Return the number of characters in string.
mwString str("This is a string"); int len = str.Length();
Return a pointer to internal buffer of string.
mwString str("This is a string"); const char* pstr = (const char*)str;
Copy the contents of one string into a new string.
mwString& str | Initialized mwString instance to copy |
mwString str("This is a string"); mwString new_str = str;
Copy the contents of a null terminated character buffer into a new string.
char* str | Null terminated character buffer to copy |
const char* pstr = "This is a string"; mwString str = pstr;
Test two mwString
instances for equality.
If the characters in the string are the same, the instances are equal.
mwString& str | Initialized mwString instance |
mwString str("This is a string"); mwString str2("This is another string"); bool ret = (str == str2);
Test two mwString
instances for inequality.
If the characters in the string are not the same, the instances are
inequal.
mwString& str | Initialized mwString instance |
mwString str("This is a string"); mwString str2("This is another string"); bool ret = (str != str2);
Compare two strings and return true
if the
first string is lexicographically less than the second string.
mwString& str | Initialized mwString instance |
mwString str("This is a string"); mwString str2("This is another string"); bool ret = (str < str2);
Compare two strings and return true
if the
first string is lexicographically less than or equal to the second
string.
mwString& str | Initialized mwString instance |
mwString str("This is a string"); mwString str2("This is another string"); bool ret = (str <= str2);
Compare two strings and return true
if the
first string is lexicographically greater than the second string.
mwString& str | Initialized mwString instance |
mwString str("This is a string"); mwString str2("This is another string"); bool ret = (str > str2);
Compare two strings and return true
if the
first string is lexicographically greater than or equal to the second
string.
mwString& str | Initialized mwString instance |
mwString str("This is a string"); mwString str2("This is another string"); bool ret = (str >= str2);
Copy contents of input string to specified ostream
.
std::ostream& os | Initialized ostream instance to copy string
into |
mwString& str | Initialized mwString instance to copy |
#include <ostream> mwString str("This is a string"); std::cout << str << std::endl;