trim: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " *\| *PARAMETER[0-9]{1,3} *= * " to " ") |
Lou Montana (talk | contribs) m (Text replacement - " \| *(game[0-9]|version[0-9]|gr[0-9]|serverExec|mp|pr|descr|s[0-9]|p[0-9]{1,3}|r[0-9]|x1?[0-9]|seealso) *= +" to " |$1= ") |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| | |game1= arma3 | ||
|version1= 2.02 | |||
|2. | |||
|gr1= Strings | |gr1= Strings | ||
| Trims a [[String|string]]. | |descr= Trims a [[String|string]]. | ||
| [[trim]] stringValue | |s1= [[trim]] stringValue | ||
|p1= stringValue: [[String]] - string to be trimmed. spaces, tabs and line returns are removed from both ends of ''stringValue''. | |p1= stringValue: [[String]] - string to be trimmed. spaces, tabs and line returns are removed from both ends of ''stringValue''. | ||
| [[String]] - trimmed string | |r1= [[String]] - trimmed string | ||
|s2= string [[trim]] [chars, where] | |s2= string [[trim]] [chars, where] | ||
Line 32: | Line 31: | ||
|x2= <code>"hewosentence!123" [[trim]] ["3e1o2hw", 0]; {{cc|returns "sentence!"}}</code> | |x2= <code>"hewosentence!123" [[trim]] ["3e1o2hw", 0]; {{cc|returns "sentence!"}}</code> | ||
| | |seealso= [[select]] | ||
}} | }} |
Revision as of 22:53, 19 June 2021
Description
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