nsString str1 = "Hello, World!"; nsString str2; str2.Assign(str1); // Assigns str1 to str2
nsString str3 = "Mozilla Gecko"; nsString str4; str4.Assign(str3, 0, 7); // Assigns "Mozilla" to str4
nsString str5; const char *rawPtr = "Gecko"; str5.Assign(rawPtr); // Assigns "Gecko" to str5These examples demonstrate different ways of using the Assign method to assign new values to nsString objects. The nsString class and its methods are a part of the Gecko SDK library, which is used for developing Firefox and Thunderbird applications.