format Summary Replaces formatting sequence(s) with their corresponding argument(s). Signatures Click on a signature to select it and view its documentation. public string format(...System.Object arguments) public string format(...external arguments) Usage public string format(...System.Object arguments) public string format(...external arguments) Returns A string with the formatting sequence(s) replaced with their corresponding argument(s) (or an empty substring if no corresponding argument is available). A string with the formatting sequence(s) replaced with their corresponding argument(s) (or an empty substring if no corresponding argument is available). Parameters arguments The arguments, in order, to replace the formatting sequences with. Parameters arguments The arguments, in order, to replace the formatting sequences with. Description Replaces formatting sequence(s) with their corresponding argument(s). Sequence Description %% The literal % character %s String formatting (calls toString) %d String formatting (calls toString) 1 %0, %1, %2, ... The nth argument as a string (calls toString) 1 %d is an alias for %s used for readability. Both formatting strings result in a toString call on the object. If a corresponding argument is not available, the formatting sequence will be replaced with an empty substring. This method is the equivalent of C's printf function. Replaces formatting sequence(s) with their corresponding argument(s). Sequence Description %% The literal % character %s String formatting (calls toString) %d String formatting (calls toString) 1 %0, %1, %2, ... The nth argument as a string (calls toString) 1 %d is an alias for %s used for readability. Both formatting strings result in a toString call on the object. If a corresponding argument is not available, the formatting sequence will be replaced with an empty substring. This method is the equivalent of C's printf function. Examples Basic Usage 123import System; Console.log("%s is %d years old".format("Joe", 10)); // Joe is 10 years old Basic Usage 123import System; Console.log("%s is %d years old".format("Joe", 10)); // Joe is 10 years old Share HTML | BBCode | Direct Link