You are viewing an older version of the site. Click here to view
the latest version of this page. (This may be a dead link, if so, try the root page of the docs
here.)
== parse_args ==
[[../../Optimizer#CACHE_RETURN|CACHE_RETURN]] |} === Usages ===
Copy Code
The output would be:
Copy Code
The output would be:
Copy Code
The output would be:
Parses string into an array, where string is a space seperated list of arguments. Handy for turning $ into a usable array of items with which to script against. Extra spaces are ignored, so you would never get an empty string as an input. useAdvanced defaults to false, but if true, uses a basic argument parser that supports quotes for allowing arguments with spaces.
=== Vital Info ===
{| style="width: 40%;" cellspacing="1" cellpadding="1" border="1" class="wikitable"
|-
! scope="col" width="20%" |
! scope="col" width="80%" |
|-
! scope="row" | Name
| parse_args
|-
! scope="row" | Returns
| array
|-
! scope="row" | Usages
| string, [useAdvanced]
|-
! scope="row" | Throws
|
|-
! scope="row" | Since
| 3.0.1
|-
! scope="row" | Restricted
| No
|-
! scope="row" | Optimizations
| [[../../Optimizer#CONSTANT_OFFLINE|CONSTANT_OFFLINE]] [[../../Optimizer#CACHE_RETURN|CACHE_RETURN]] |} === Usages ===
parse_args(string, [useAdvanced])=== Examples === ====Example 1==== Demonstrates basic usage Given the following code:
parse_args('This turns into 5 arguments')

1 {{function|parse_args}}('This turns into 5 arguments')
:{This, turns, into, 5, arguments}====Example 2==== Demonstrates usage with extra spaces Given the following code:
parse_args('This trims extra spaces')

1 {{function|parse_args}}('This trims extra spaces')
:{This, trims, extra, spaces}====Example 3==== With the advanced mode (escapes are also supported with \, for instance \' Given the following code:
parse_args('This supports "quoted arguments"', true)

1 {{function|parse_args}}('This supports "quoted arguments"', {{keyword|true}})
:{This, supports, quoted arguments}
Find a bug in this page? Edit this page yourself, then submit a pull request. (Note this page is automatically generated from the documentation in the source code.)