trim: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Add example)
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame( +[0-9])?|Game [Vv]ersion( +[0-9])?|Game Version \(number surrounded by NO SPACES\)|Arguments in MP|MP[Aa]rg|Multiplayer Arguments( \("local" or "global"\))?|Effects|Execution|Effects...)
Line 1: Line 1:
{{Command|Comments=
{{Command


| arma3dev |Game name=
| arma3dev


|2.01|Game version=
|2.01


|gr1= Strings |GROUP1=
|gr1= Strings


| Trims a [[String|string]]. |DESCRIPTION=
| Trims a [[String|string]].


| [[trim]] stringValue |SYNTAX=
| [[trim]] stringValue


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


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


|s2= string [[trim]] [chars, where] |SYNTAX2=
|s2= string [[trim]] [chars, where]


|p21= string: [[String]] - string to be trimmed |PARAMETER21=
|p21= string: [[String]] - string to be trimmed |PARAMETER21=
Line 26: Line 26:
* 2 - trim at the end (right) |PARAMETER23=
* 2 - trim at the end (right) |PARAMETER23=


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


|x1= <code>[[trim]] " hello, how are you?  "; {{cc|returns "hello, how are you?"}}</code> |EXAMPLE1=
|x1= <code>[[trim]] " hello, how are you?  "; {{cc|returns "hello, how are you?"}}</code>


|x2= <code>"hewosentence!123" [[trim]] ["3e1o2hw", 0]; {{cc|returns "sentence!"}}</code> |EXAMPLE2=
|x2= <code>"hewosentence!123" [[trim]] ["3e1o2hw", 0]; {{cc|returns "sentence!"}}</code>


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

Revision as of 12:24, 18 January 2021

-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:
trim " hello, how are you? "; // returns "hello, how are you?"
Example 2:
"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]]