trim: Difference between revisions
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...") |
Lou Montana (talk | contribs) m (Text replacement - " | arma3dev |2.01 " to " | arma3 |2.02 ") |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=command | ||
| | | arma3 | ||
|2. | |2.02 | ||
|gr1= Strings | |gr1= Strings | ||
| Trims a [[String|string]]. | | Trims a [[String|string]]. | ||
| | | [[trim]] stringValue | ||
|p1= | |p1= stringValue: [[String]] - string to be trimmed. spaces, tabs and line returns are removed from both ends of ''stringValue''. | ||
| | | [[String]] - trimmed string | ||
| | |s2= string [[trim]] [chars, where] | ||
| [[ | |p21= string: [[String]] - string to be trimmed | ||
|p22= chars: [[String]] - list of characters to be trimmed | |||
|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) | |||
|r2= [[String]] - trimmed string | |||
|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> | |||
|seealso= [[select]] | |||
}} | }} |
Revision as of 14:56, 23 February 2021
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:
- 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