• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • sass:string

    string.quote()

    string.quote($string)
    quote($string) //=> string
    

    $string作为带引号的字符串返回。

    @debug string.quote(Helvetica); // "Helvetica"
    @debug string.quote("Helvetica"); // "Helvetica"
    


    string.index()

    string.index($string, $substring)
    str-index($string, $substring) //=> number
    

    返回$substring$string位置中的第一个索引。如果不包含,则返回null

    @debug string.index("Helvetica Neue", "Helvetica"); // 1
    @debug string.index("Helvetica Neue", "Neue"); // 11
    


    string.insert()

    string.insert($string, $insert, $index)
    str-insert($string, $insert, $index) //=> string
    

    根据索引$index位置,在$string中,插入$insert,返回字符串副本结果。

    @debug string.insert("Roboto Bold", " Mono", 7); // "Roboto Mono Bold"
    @debug string.insert("Roboto Bold", " Mono", -6); // "Roboto Mono Bold"
    

    如果$index大于$string的长度,则$insert添加到末尾。如果$index小于字符串的负长度,则$insert添加到$string开头。

    @debug string.insert("Roboto", " Bold", 100); // "Roboto Bold"
    @debug string.insert("Bold", "Roboto ", -100); // "Roboto Bold"
    


    string.length()

    string.length($string)
    str-length($string) //=> number
    

    返回$string中的字符数。

    @debug string.length("Helvetica Neue"); // 14
    @debug string.length(bold); // 4
    @debug string.length(""); // 0
    


    string.slice()

    string.slice($string, $start-at, $end-at: -1)
    str-slice($string, $start-at, $end-at: -1) //=> string 
    

    $string中,截取开始位置$start-at,到结束位置$end-at(包括两者)。

    @debug string.slice("Helvetica Neue", 11); // "Neue"
    @debug string.slice("Helvetica Neue", 1, 3); // "Hel"
    @debug string.slice("Helvetica Neue", 1, -6); // "Helvetica"
    


    string.to-upper-case()

    string.to-upper-case($string)
    to-upper-case($string) //=> string
    

    返回 ASCII 字母转换为大写$string的副本。

    @debug string.to-upper-case("Bold"); // "BOLD"
    @debug string.to-upper-case(sans-serif); // SANS-SERIF
    


    string.to-lower-case()

    string.to-lower-case($string)
    to-lower-case($string) //=> string
    

    返回 ASCII 字母转换为小写$string的副本。

    @debug string.to-lower-case("Bold"); // "bold"
    @debug string.to-lower-case(SANS-SERIF); // sans-serif
    


    string.unique-id()

    string.unique-id()
    unique-id() //=> string
    

    返回一个随机生成的不带引号的字符串,它保证是一个有效的 CSS 标识符并且在当前 Sass 编译中是唯一的。

    @debug string.unique-id(); // uabtrnzug
    @debug string.unique-id(); // u6w1b1def
    


    string.unquote()

    string.unquote($string)
    unquote($string) //=> string
    

    $string作为不带引号的字符串返回。这会产生无效的CSS字符串,因此请谨慎使用。

    @debug string.unquote("Helvetica"); // Helvetica
    @debug string.unquote(".widget:hover"); // .widget:hover
    

    上篇:sass:selector