Re: Problem with split()
- Posted by andreasWagner 1 month ago
- 392 views
Hallo
CraigWelch said...
From the documentation:
Example 2:
result = split("John,Middle,Doe", ",",, 2) -- Only want 2 sub-sequences. -- result is {"John", "Middle,Doe"}
My actual result:
result = split("John,Middle,Doe", ",",, 2) -- Only want 2 sub-sequences. -- result is {"John", "Middle", "Doe"}
However:
result = split("John,Middle,Doe", ",",, 1) -- Only want 2 sub-sequences. -- result is {"John", "Middle,Doe"}
In other words, the 'limit' operator needs to be one less than desired / documented.
This has probably been discussed before.
Here: https://openeuphoria.org/forum/m/131078.wc
perhaps good to know:
Phix apparently adheres to the documentation here and is therefore incompatible in this case.
Andreas

