创新互联less教程:Less字符串函数
描述
本节将介绍 Less 字符串函数。

专注于为中小企业提供成都网站制作、成都网站建设、外贸营销网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业恩平免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了上1000家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
Less支持以下列出的一些字符串函数:
-
逃逸
-
e
-
%格式
-
更换
下表描述了上述字符串函数及其说明。
| S.N. | 类型及描述 | 例子 |
|---|---|---|
| 1 | Escape 它通过对特殊字符使用URL编码来对字符串或信息进行编码。 您无法编码一些字符,例如,, / ,? , @ ,& , + ,〜,! , $ ,\'和您可以编码的一些字符,例如 \\ ,#, > ^ ,(,), {,} ,: >,> ,,] , [和 = 。 |
escape("Hello!! welcome to Tutorialspoint!")
它输出转义字符串为: Hello%21%21%20welcome%20to%20Tutorialspoint%21 |
| 2 | e 它是一个字符串函数,它使用string作为参数,并返回不带引号的信息。 它是一个CSS转义,它使用〜“一些内容"转义的值和数字作为参数。 |
filter: e("Hello!! welcome to Tutorialspoint!");
它输出转义字符串为: filter: Hello!! welcome to Tutorialspoint!; |
| 3 | % format 此函数格式化一个字符串。 它可以写成以下格式: %(string,arguments ...)
|
format-a-d: %("myvalues: %a myfile: %d", 2 + 3, "mydir/less_demo.less");
它输出格式化的字符串为: format-a-d: "myvalues: 5 myfile: "mydir/less_demo.less""; |
| 4 | replace 它用于替换字符串中的文本。 它使用一些参数:
|
replace("Welcome, val?", "val\?", "to Tutorialspoint!");
它将字符串替换为: "Welcome, to Tutorialspoint!" |
分享文章:创新互联less教程:Less字符串函数
网站URL:http://www.jxjierui.cn/article/coioeip.html


咨询
建站咨询
