Sass 简介
Sass 安装
Sass 变量
Sass Nested Rules and Properties
Sass @import and Partials
Sass @mixin and @include
Sass @extend and Inheritance
Sass 函数
Sass String
Sass Numeric
Sass List
Sass Map
Sass Selector
Sass Introspection
Sass Color
Sass String - SASS基础教程 - 笔下光年
网站首页
Sass String
The string functions are used to manipulate and get information about strings. Sass strings are 1-based. The first character in a string is at index 1, not 0. The following table lists all string functions in Sass: | Function | Description & Example | |--------------|-----------------------------| | quote(string) | Adds quotes to string, and returns the result.<br/><br/>**Example:**<br/>`quote(Hello world!)`<br/>Result: `"Hello world!"` | | str-index(string, substring) | Returns the index of the first occurrence of the substring within `string`.<br/><br/>**Example:**<br/>`str-index("Hello world!", "H")`<br/>Result: `1` | | str-insert(string, insert, index) | Returns string with insert inserted at the specified index position.<br/><br/>**Example:**<br/>`str-insert("Hello world!", " wonderful", 6)`<br/>Result: `"Hello wonderful world!"` | | str-length(string) | Returns the length of string (in characters). <br/><br/>**Example:**<br/>`str-length("Hello world!")`<br/>Result: `12` | | str-slice(string, start, end) | Extracts characters from string; start at start and end at end, and returns the slice. <br/>**Example:**<br/>`str-slice("Hello world!", 2, 5)`<br/>Result: `"ello"` | | to-lower-case(string) | Returns a copy of string converted to lower case. <br/><br/>**Example:**<br/>`to-lower-case("Hello World!")`<br/>Result: `"hello world!"` | | to-upper-case(string) | Returns a copy of string converted to upper case. <br/><br/>**Example:**<br/>`to-upper-case("Hello World!")`<br/>Result: "HELLO WORLD!" | | unique-id() | Returns a unique randomly generated unquoted string (guaranteed to be unique within the current sass session). <br/><br/>**Example:**<br/>`unique-id()`<br/>Result: `tyghefnsv` | | unquote(string) | Removes quotes around string (if any), and returns the result. <br/><br/>**Example:**<br/>`unquote("Hello world!")`<br/>Result: `Hello world!` |
上一篇:
Sass 函数
下一篇:
Sass Numeric