String (Constructor) Summary Constructs a System.String object. Signatures Click on a signature to select it and view its documentation. public String() public String(string initialValue) public String(char[] initialValue) Usage public String() public String(string initialValue) public String(char[] initialValue) Parameters initialValue The value to initialize the System.String object to. Parameters initialValue The characters to initialize the System.String object's string value from. Description Constructs a System.String object with a default value of "" (an empty string). Constructs a System.String object with a specified string value. Constructs a System.String object with a specified string value constructed from a character array. Examples Basic Usage 1234import System; String s = new String();Console.log(s.valueOf() == String.EMPTY); // true Basic Usage 1234import System; String s = new String("abc");Console.log(s.valueOf() == "abc"); // true Basic Usage 12345import System; char[] abc = [ `a`, `b`, `c` ];String s = new String(abc);Console.log(s.valueOf() == "abc"); // true Share HTML | BBCode | Direct Link