string – glib-2.0 (original) (raw)


Object Hierarchy:

string string string

Description:

[ Compact ]
[ Immutable ]
[ GIR ( name = "utf8" ) ]
[ CCode ( cname = "gchar" , const_cname = "const gchar" , copy_function = "g_strdup" , free_function = "g_free" , get_value_function = "g_value_get_string" , marshaller_type_name = "STRING" , param_spec_function = "g_param_spec_string" , set_value_function = "g_value_set_string" , take_value_function = "g_value_take_string" , type_id = "G_TYPE_STRING" , type_signature = "s" ) ]
public class string

Example: General samples:

public static int main (string[] args) {
    string str1 = "U = R * I";
    string str2 = "R = U / I";
    string str3 = @"$str1; $str2";

    // Concat:
    // Output: ``U = R * I; R = U / I``
    print (str3 + "\n");

    // Copy:
    // Output: ``0x82e4588 != 0x82e45a8true``
    string str4 = str3;
    print ("%p != %p\n", str3, str4);

    // Compare:
    // Output: ``true``
    if (str4 == str3) {
       print ("true\n");
    } else {
        print ("false\n");
    }

    // Verbatim strings:
    // Output:
    //  ``\tfoo``
    //  ``bar``
    //  ``\t``
    string str5 = """\tfoo
bar
\t
""";
    print (str5);
    return 0;
}

valac --pkg glib-2.0 string.vala

Content:

Properties:

Static methods:

Methods:

Fields: