This static method of the System.String class is very, very useful.
It permits you to insert values into a string, like in this sample:
cString := String.Format( "Today is {0}", DateTime.Now:ToShortDateString() )
.
You can also control the formatting:
cString := String.Format( "It is now {0:d} at {0:t}", DateTime.Now )
For more details please see the Microsoft documentation: Get started with the String.Format method
Here are a few samples:
String.Format( "'{0,10}'", 100 ) -> ' 100' String.Format( "'{0,-10}'", 100 ) -> '100 ' String.Format( "{0:0000000}", 1234 ) -> 0001234 String.Format( "{0:0000}", 1234 ) -> 1234 String.Format( "'{0,10}'", 1234 ) -> ' 1234' String.Format( "'{0,4}'", 1234 ) -> '1234' nValue:ToString( "10" ) -> 11234 nValue:ToString( "4" ) -> 4 String.Format( "{0:yyyy.MM.dd HH:mm:ss}", DateTime.Now ) -> 2019.07.30 11:49:36 nDecimal := 123456789.987654321m String.Format( "{0}", nDecimal ) -> 123456789,987654321 nDecimal:ToString( "############.##" ) -> 123456789,99 nDecimal:ToString( "############.#######" ) -> 123456789,9876543 nDecimal:ToString( "#.##" ) -> 123456789,99 nValue := 123 nValue:ToString( "0000" ) ) -> 0123 nValue:ToString( "####" ) ) -> 123 String.Format( "'{0,4}'", 123 ) -> ' 123'