- Less Basic Tutorial
- Less - Home
- Less - Overview
- Less - Installation
- Language Features
- Less - Nested Rules
- Less - Nested Directives and Bubbling
- Less - Operations
- Less - Escaping
- Less - Functions
- Less - Namespaces and Accessors
- Less - Scope
- Less - Comments
- Less - Importing
- Less - Variables
- Less - Extend
- Less - Mixins
- Less - Parametric Mixins
- Less - Mixins as Functions
- Less - Passing Rulesets to Mixins
- Less - Import Directives
- Less - Import Options
- Less - Mixin Guards
- Less - CSS Guards
- Less - Loops
- Less - Merge
- Less - Parent Selectors
- Functions
- Less - Misc Functions
- Less - String Functions
- Less - List Functions
- Less - Math Functions
- Less - Type Functions
- Less - Color Defination Functions
- Less - Color Channel Functions
- Less - Color Operation
- Less - Color Blending Functions
- Usage
- Less - Command Line Usage
- Using Less In The Browser
- Less - Browser support
- Less - Plugins
- Less - Programmatic Usage
- Less - Online Compilers
- Less - GUIs
- Less - Editors and Plugins
- Less - Third Party Compilers
- Less - Frameworks
- Less Useful Resources
- Less - Quick Guide
- Less - Useful Resources
- Less - Discussion
LESS - String Functions
Description
Less supports some of the string functions as listed below −
- escape
- e
- % format
- replace
The following table describes the above string functions along with description.
Sr.No. | Types & Description | Example |
---|---|---|
1 | Escape It encodes a string or information by using URL encoding on special characters. You could not encode some characters such as , , / , ? , @ , & , + , ~ , ! , $ , ' and some characters you can encode such as \ , # , ^ , ( , ) , { , } , : , > , < , ] , [ and =. |
escape("Hello!! welcome to Tutorialspoint!") It outputs escaped string as − Hello%21%21%20welcome%20to%20Tutorialspoint%21 |
2 | e It is a string function which uses string as parameter and returns the information without quotes. It is a CSS escaping which uses ~"some content" escaped values and numbers as parameters. |
filter: e("Hello!! welcome to Tutorialspoint!"); It outputs escaped string as − filter: Hello!! welcome to Tutorialspoint!; |
3 | % format This function formats a string. It can be written with the following format − %(string, arguments ...) |
format-a-d: %("myvalues: %a myfile: %d", 2 + 3, "mydir/less_demo.less"); It outputs the formatted string as − format-a-d: "myvalues: 5 myfile: "mydir/less_demo.less""; |
4 | replace It is used to replace the text within a string. It uses some parameters −
|
replace("Welcome, val?", "val\?", "to Tutorialspoint!"); It replaces the string as − "Welcome, to Tutorialspoint!" |