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.
mono_string_new
text | a pointer to an utf8 string |
This function asserts if it cannot allocate a new string.
deprecated Use mono_string_new_checked in new code.
mono_string_new_len
text | a pointer to an utf8 string |
length | number of bytes in text to consider |
mono_string_new_size
text | a pointer to an utf16 string |
len | the length of the string |
mono_string_new_utf16
text | a pointer to an utf16 string |
len | the length of the string |
mono_string_new_utf32
text | a pointer to an utf32 string |
len | the length of the string |
mono_string_from_utf16
data | the UTF16 string (LPWSTR) to convert |
Converts a NULL
terminated UTF16 string (LPWSTR) to a MonoString.
mono_string_from_utf32
data | the UTF32 string (LPWSTR) to convert |
Converts a UTF32 (UCS-4)to a MonoString.
mono_string_to_utf16
s | 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.
mono_string_to_utf8
s | 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.
mono_string_to_utf8_checked
s | a System.String |
error | a MonoError. |
Converts a MonoString to its UTF8 representation. May fail; check error to determine whether the conversion was successful. The resulting buffer should be freed with mono_free().
mono_string_to_utf32
s | a MonoString |
Return an null-terminated array of the UTF-32 (UCS-4) chars contained in s. The result must be freed with g_free().
mono_string_equal
s1 | First string to compare |
s2 | Second string to compare |
Compares two MonoString*
instances ordinally for equality.
Returns FALSE
if the strings differ.
mono_string_hash
s | the string to hash |
Compute the hash for a MonoString*
Returns the hash for the string.
mono_string_intern
o | String to intern |
Interns the string passed.
mono_string_is_interned
o | String to probe |
Returns whether the string has been interned.
mono_string_new_wrapper
text | pointer to utf8 characters. |
Helper function to create a string object from text in the current domain.
mono_string_chars
s | a MonoString |
Returns a pointer to the UCS16 characters stored in the MonoString