Opened 18 years ago
Closed 17 years ago
#120 closed Feature Request (Rejected)
StringSplit limit parameter
| Reported by: | Paulie | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Severity: | None | |
| Keywords: | Stringsplit | Cc: |
Description
StringSplit("String","delimiters"[, flag [,limit]])
I was wondering how big of a hassle it would be to make StringSplit have an additional optional parameter that would limit the amount of splits. Similar to PHPs "explode"
Example
$String = "Test1|Test2|Test3|Test4" $Result = StringSplit($String, "|",1,2);<-2 would split to 2 elements (perform 1 split)
$Result[0] = 2 (redundant i suppose :\)
$Result[1] = "Test1"
$Result[2] = "Test2|Test3|Test4"
Reason
There have been multiple time that I've found myself splitting a long string only to use the first few elements, while it hasn't been a problem to use the current stringsplit for this, it seems like a feature that wouldn't hurt (especially considering it would be an optional param, so no script breaks)
I'm sure it's been considered, but i didn't see it suggested.
Thanks.
Attachments (0)
Change History (4)
comment:1 by , 18 years ago
| Version: | 3.2.10.0 (Stable) |
|---|
comment:2 by , 18 years ago
comment:3 by , 18 years ago
I would prefer to have a _StringExplode() Standard UDF than to add such extension to basic StringSplit()
comment:4 by , 17 years ago
| Resolution: | → Rejected |
|---|---|
| Severity: | → None |
| Status: | new → closed |
I sort of agree with JP. If this is still important to anybody then somebody should take the appropriate steps to submit a _StringExplode() function.

I posted an Explode function for anyone needing something like this:
http://www.autoitscript.com/forum/index.php?showtopic=64801&hl=explode