Template:Str crop: Difference between revisions
Template page
More actions
Created page with "<includeonly>{{safesubst:#invoke:String | sub | s={{{1|}}} | 1 | {{safesubst:#expr: -{{{2|1}}} - 1}} | ignore_errors=true }}</includeonly><noinclude> {{documentation}}</noinclude>" |
(No difference)
|
Latest revision as of 06:17, 20 February 2025
Usage
Use to remove the right-most {{{2}}} characters of a string {{{1}}}.
Example
| Code | Result |
|---|---|
{{str crop |Example |3}}
|
Exam |
{{str crop |123.456|3}}
|
123. |
{{str crop |123.456|-3}}
|
12 |
{{str crop |123.456|4}}
|
123 |
{{str crop |123.456|-4}}
|
123 |
{{str crop |123.456|0}}
|
123.456 |
{{str crop |123.456|7}}
|