وظائف الأعداد المتمثلة Sass

وظائف الأعداد المتمثلة Sass

String functions are used to operate and obtain information about strings.

Sass strings start from 1. The first character of the string is located at index 1, not 0.

The following table lists all the string functions in Sass:

Functions Description & Examples
quote(string)

adds quotes to the string and returns the result.

مثال:

quote(Hello world!)

result: "Hello world!"

str-index(string, substring)

returns the index of the first occurrence of the substring in the string.

مثال:

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

result: 1

str-insert(string, insert, index)

returns inserting at the specified index position insert of the string.

مثال:

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

result: "Hello wonderful world!"

str-length(string)

returns the length of the string (in characters).

مثال:

str-length("Hello world!")

النتيجة: 12

str-slice(string, start, end)

استخراج حروف من النص؛ من start من end النهاية، وإرجاع القطعة.

مثال:

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

النتيجة: "ello"

to-lower-case(string)

يعيد نسخة من النص المحول إلى حروف صغيرة.

مثال:

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

النتيجة: "hello world!"

to-upper-case(string)

يعيد نسخة من النص المحول إلى حروف كبيرة.

مثال:

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

النتيجة: "HELLO WORLD!"

unique-id()

يعيد دالة تعطي نصًا غير مسبوقًا ومقيدًا بلا أقواس مزدوجة (مضمونًا في جلسة sass الحالية).

مثال:

unique-id()

النتيجة: tyghefnsv

unquote(string)

إزالة الأقواس المزدوجة المحيطة بالخطاب (إذا كانت موجودة)، وإرجاع النتيجة.

مثال:

unquote("Hello world!")

النتيجة: Hello world!