字符串函数
escape
对字符串中的特殊字符做 URL-encoding 编码。
这些字符不会被编码:,, /, ?, @, &, +, ', ~, ! and $。
被编码的字符是:\
escape('a=1') // return a%3D1
% 格式化
此函数 %(string, arguments ...) 用于格式化字符串。
format-a-d: %("repetitions: %a file: %d", 1 + 2, "directory/file.less");
输出:
format-a-d: "repetitions: 3 file: "directory/file.less"";
replace
用一个字符串替换一段文本。
replace("Hello, Mars?", "Mars\?", "Earth!");
输出:
"Hello, Earth!";