String interpolation is common in many programming languages including modern languages like Dart, Swift, etc and I am glad that it is also available in Haxe.
String interpolation provides an intuitive way of formatting strings in place of string concatenation. It is a compile-time feature and has no impact on the runtime in Haxe.
$
sign should be used for placeholders and string should be enclosed in single-quote '
character as shown in the example below.
Next, StringTools is another useful class for advanced string manipulation and formatting. It’s kept separate to keep the core String class light and this class can be used based on the application needs.
StringTools should be used as a static extension to the String class with using
keyword as shown below.
Definition of Static Extension as per the official documentation:
A static extension allows pseudo-extending existing types without modifying their source. In Haxe this is achieved by declaring a static method with a first argument of the extending type and then bringing the defining class into context through
using
.