trim: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Command " to "{{RV|type=command ")
m (Text replacement - " *\| *PARAMETER[0-9]{1,3} *= * " to " ")
Line 17: Line 17:
|s2= string [[trim]] [chars, where]
|s2= string [[trim]] [chars, where]


|p21= string: [[String]] - string to be trimmed |PARAMETER21=
|p21= string: [[String]] - string to be trimmed


|p22= chars: [[String]] - list of characters to be trimmed |PARAMETER22=
|p22= chars: [[String]] - list of characters to be trimmed


|p23= where: [[Number]] - Can be:
|p23= where: [[Number]] - Can be:
* 0 - trim at the beginning (left) and the end (right)
* 0 - trim at the beginning (left) and the end (right)
* 1 - trim at the beginning (left)
* 1 - trim at the beginning (left)
* 2 - trim at the end (right) |PARAMETER23=
* 2 - trim at the end (right)


|r2= [[String]] - trimmed string
|r2= [[String]] - trimmed string

Revision as of 18:15, 29 January 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Strings

Syntax

Syntax:
Syntax needed
Parameters:
stringValue: String - string to be trimmed. spaces, tabs and line returns are removed from both ends of stringValue.
Return Value:
Return value needed

Alternative Syntax

Syntax:
string trim [chars, where]
Parameters:
string: String - string to be trimmed
chars: String - list of characters to be trimmed
where: Number - Can be:
  • 0 - trim at the beginning (left) and the end (right)
  • 1 - trim at the beginning (left)
  • 2 - trim at the end (right)
Return Value:
String - trimmed string

Examples

Example 1:
trim " hello, how are you? "; // returns "hello, how are you?"
Example 2:
"hewosentence!123" trim ["3e1o2hw", 0]; // returns "sentence!"

Additional Information

See also:
See also needed

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note