ThakeeNathees / pocketlang

A lightweight, fast embeddable scripting language.
https://thakeenathees.github.io/pocketlang/
MIT License
1.52k stars 80 forks source link

[Enhancement] modify stringSplit to support \x00 and empty string #274

Open khchen opened 2 years ago

khchen commented 2 years ago
  1. String in pocketlang could be include \x00, but String.split() don't.
  2. If [sep] is empty, split string into characters.
  3. String.split should be the opposite of List.join perfectly.

Example:

print("a\x00b\x00c".split('\x00'))
print("abcde".split())

Output:

["a", "b", "c"]
["a", "b", "c", "d", "e"]