trim: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{Command|Comments= | arma3dev |Game name= |2.01|Game version= |gr1= Strings |GROUP1= | Trims a string. |DESCRIPTION= | string trim [chars, where]] |SYNTAX...")
 
(Add primary syntax)
Line 9: Line 9:
| Trims a [[String|string]]. |DESCRIPTION=
| Trims a [[String|string]]. |DESCRIPTION=


| string [[trim]] [chars, where]] |SYNTAX=
| [[trim]] stringValue |SYNTAX=


|p1= string: [[String]] - String to be trimmed |PARAMETER1=
|p1= stringValue: [[String]] - string to be trimmed. spaces, tabs and line returns are removed from both ends of ''stringValue''. |PARAMETER1=


|p2= chars: [[String]] - List of chars to be trimmed |PARAMETER2=
| [[String]] - trimmed string |RETURNVALUE=


|p3= where: [[Number]] - Can be:
|s2= string [[trim]] [chars, where] |SYNTAX2=
* 0 - Trimm at the beginning (left) and the end (right)
 
* 1 - Only trimm at the beginning (left)
|p21= string: [[String]] - string to be trimmed |PARAMETER21=
* 2 - Only trimm at the end (right) |PARAMETER3=
 
| [[String]] - Trimmed string |RETURNVALUE=
|p22= chars: [[String]] - list of characters to be trimmed |PARAMETER22=
 
 
|x1= <code>"hewostring123" [[trim]] ["123hewo", 0]; {{cc|Returns "string"}}</code> |EXAMPLE1=
|p23= 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) |PARAMETER23=
 
|r2= [[String]] - trimmed string |RETURNVALUE2=
 
|x1= <code>"hewosentence!123" [[trim]] ["3e1o2hw", 0]; {{cc|Returns "sentence!"}}</code> |EXAMPLE1=


|  [[select]] |SEEALSO=
|  [[select]] |SEEALSO=
}}
}}

Revision as of 01:39, 24 November 2020

-wrong parameter ("arma3dev") defined!-[[:Category:Introduced with arma3dev version 2.01|2.01]]
Hover & click on the images for description

Description

Description:
Trims a string.
Groups:
Strings

Syntax

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

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:
"hewosentence!123" trim ["3e1o2hw", 0]; // Returns "sentence!"

Additional Information

See also:
select

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

[[Category:Introduced with arma3dev version 2.01]][[ Category: arma3dev: New Scripting Commands | TRIM]][[ Category: arma3dev: Scripting Commands | TRIM]]