Σtring Functions Sass

Σtring Functions Sass

Οι λειτουργίες αλφαβητικών αλυσίδων χρησιμοποιούνται για τη λειτουργία και την απόκτηση πληροφοριών σχετικά με τις αλφαβητικές αλυσίδες.

Οι αλφαβητικές αλυσίδες του Sass ξεκινούν από 1. Ο πρώτος χαρακτήρας της αλφαβητικής αλυσίδας βρίσκεται στην ενότητα 1, όχι 0.

Η παρακάτω τаблицή περιλαμβάνει όλες τις λειτουργίες αλφαβητικών αλυσίδων του Sass:

Λειτουργία Περιγραφή & Παράδειγμα
quote(string)

Προσθέτει εισαγωγικά στην αλφαβητική αλυσίδα και επιστρέφει το αποτέλεσμα.

Example:

quote(Hello world!)

Επίδραση: "Hello world!"

str-index(string, substring)

Επιστρέφει την πρώτη εμφάνιση του υποσυνόλου στην αλφαβητική αλυσίδα.

Example:

str-index("Hello world!", "H")

Επίδραση: 1

str-insert(string, insert, index)

Επιστρέφει την εισαγωγή του στοιχείου στην καθορισμένη θέση. insert της αλφαβητικής αλυσίδας.

Example:

str-insert("Hello world!", " wonderful", 6)

Επίδραση: "Hello wonderful world!"

str-length(string)

Επιστρέφει τη μήκος της αλφαβητικής αλυσίδας (σε χαρακτήρες).

Example:

str-length("Hello world!")

Result: 12

str-slice(string, start, end)

Extract characters from the string; from start Start to end End, and return the slice.

Example:

str-slice("Hello world!", 2, 5)

Result: "ello"

to-lower-case(string)

Returns a copy of the string converted to lowercase.

Example:

to-lower-case("Hello World!")

Result: "hello world!"

to-upper-case(string)

Returns a copy of the string converted to uppercase.

Example:

to-upper-case("Hello World!")

Result: "HELLO WORLD!"

unique-id()

Returns a unique randomly generated string without quotes (guaranteed to be unique in the current Sass session).

Example:

unique-id()

Result: tyghefnsv

unquote(string)

Remove the quotes around the string (if any) and return the result.

Example:

unquote("Hello world!")

Result: Hello world!