String

escape(@string) Applies URL-encoding to special characters found in the input string.
These characters are not encoded: ,, /, ?, @, &, +, ', ~, ! and $.
Most common encoded characters are: \, #, ^, (, ), {, }, |, :, >, <, ;, ], [ and =.
e(@string) CSS escaping, replaced with ~"value" syntax. It expects string as a parameter and return its content as is, but without quotes. It can be used to output CSS value which is either not valid CSS syntax, or uses proprietary syntax which Less doesn't recognize.
%(@string) Formats a string. The first argument is string with placeholders. All placeholders start with percentage symbol % followed by letter s,S,d,D,a, or A. Remaining arguments contain expressions to replace placeholders. If you need to print the percentage symbol, escape it by another percentage %%. Use uppercase placeholders if you need to escape special characters into their utf-8 escape codes. The function escapes all special characters except ()'~!. Space is encoded as %20. Lowercase placeholders leave special characters as they are.
replace(@string,@pattern,@replacement[, @flags]) Replaces a text within a string.

.a:after{
   content: escape('a=1');
}
.b:after{
   content: e("ms:alwaysHasItsOwnSyntax.For.Stuff()");
}
.c:after{
   content:
    %("repetitions: %a file: %d", 1 + 2, "directory/file.less")
    %('repetitions: %A file: %D', 1 + 2, "directory/file.less")
    %("repetitions: %s file: %s", 1 + 2, "directory/file.less")
    %('repetitions: %S file: %S', 1 + 2, "directory/file.less");
}
.d:after{
   content:
   replace("Hello, Mars?", "Mars\?", "Earth!")
   replace("One + one = 4", "one", "2", "gi")
   replace('This is a string.', "(string)\.$", "new $1.")
   replace(~"bar-1", '1', '2');
}

.a:after {
  content: a%3D1;
}
.b:after {
  content: ms:alwaysHasItsOwnSyntax.For.Stuff();
}
.c:after {
  content: "repetitions: 3 file: "directory/file.less"" 'repetitions: 3 file: %22directory%2Ffile.less%22' "repetitions: 3 file: directory/file.less" 'repetitions: 3 file: directory%2Ffile.less';
}
.d:after {
  content: "Hello, Earth!" "2 + 2 = 4" 'This is a new string.' bar-2;
}