Strings representation inside the Mono runtime.
All of the operations on strings are done on pointers to MonoString objects, like this:
Strings are bound to a particular application domain, which is why it is necessary to pass a MonoDomain argument as the first parameter to all the constructor functions.
Typically, you want to create the strings on the current application domain, so a call to mono_domain_get() is sufficient.
Parameters
Returnstext: a pointer to an utf8 string
A newly created string object which contains text.
Parameters
Returnstext: a pointer to an utf8 string length: number of bytes in text to consider
A newly created string object which contains text.
Parameters
Returnstext: a pointer to an utf16 string len: the length of the string
A newly created string object of len
Parameters
Returnstext: a pointer to an utf16 string len: the length of the string
A newly created string object which contains text.
Parameters
Returnsdata: the UTF16 string (LPWSTR) to convert
a MonoString.Remarks
Converts a NULL terminated UTF16 string (LPWSTR) to a MonoString.
Parameters
Remarkss: a MonoString
Return an null-terminated array of the utf-16 chars contained in s. The result must be freed with g_free(). This is a temporary helper until our string implementation is reworked to always include the null terminating char.
Parameters
Remarkss: a System.String
Returns the UTF8 representation for s. The resulting buffer needs to be freed with mono_free(). deprecated Use mono_string_to_utf8_checked to avoid having an exception arbritraly raised.
Parameters
Remarkss1: First string to compare s2: Second string to compare
Returns FALSE if the strings differ.
Parameters
Remarkss: the string to hash
Returns the hash for the string.
Parameters
Returnso: String to intern
The interned string.Remarks
Interns the string passed.
Parameters
Remarkso: String to probe
Returns whether the string has been interned.
Parameters
Remarkstext: pointer to utf8 characters.
Helper function to create a string object from text in the current domain.
Parameters
Remarkss: a MonoString
Returns a pointer to the UCS16 characters stored in the MonoString
Parameters
Remarkss: MonoString
Returns the lenght in characters of the string
These routines are used when coping with strings that come from Mono's environment, and might be encoded in one or more of the external encodings.
For example, some file systems might historically contain a mix of file names with both old and new encodings, typically UTF8 for new files, and the old files would be encoded in an 8 bit character set (ISO-8859-1 for example).
These routines try a number of encodings, those specified in the MONO_ENCODINGS environment variable and return unicode strings that can be used internally.
See the mono(1) man page for more details.
Parameters
Remarksin: pointers to the buffer. bytes: number of bytes in the string.
Tries to turn a NULL-terminated string into UTF16. First, see if it's valid UTF8, in which case just turn it directly into UTF16. Next, run through the colon-separated encodings in MONO_EXTERNAL_ENCODINGS and do an iconv conversion on each, returning the first successful conversion to UTF16. If no conversion succeeds, return NULL. Callers must free the returned string if not NULL. bytes holds the number of bytes in the returned string, not including the terminator.
Parameters
Remarksuni: an UTF16 string to conver to an external representation.
Turns NULL-terminated UTF16 into either UTF8, or the first working item in MONO_EXTERNAL_ENCODINGS if set. If no conversions work, then UTF8 is returned. Callers must free the returned string.