Strings

Strings representation inside the Mono runtime.

Synopsis

#include <metadata/object.h> typedef struct { MonoObject object; gint32 length; gunichar2 chars [0]; } MonoString; @API_IDX@

All of the operations on strings are done on pointers to MonoString objects, like this:

MonoString *hello = mono_string_new (mono_domain_get (), "hello, world");

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.

Constructors

mono_string_new

mono_string_new_len

mono_string_new_size

mono_string_new_utf16

mono_string_from_utf16

Conversions

mono_string_to_utf16

mono_string_to_utf8

Methods

mono_string_equal

mono_string_hash

mono_string_intern

mono_string_is_interned

mono_string_new_wrapper

mono_string_chars

mono_string_length

Other Encodings

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.

mono_unicode_from_external

mono_unicode_to_external

mono_utf8_from_external