question

Gui Vaccaro avatar image
0 Likes"
Gui Vaccaro asked Emily Hardy answered

Problem (?) with string string.split()?

Hello, any reasons why this happens?

1736785177166.pngShould not this command return Array[0]? I.e., why is the length 1?

FlexSim 25.0.1
stringsplit
1736785177166.png (10.0 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Emily Hardy avatar image
3 Likes"
Emily Hardy answered Gui Vaccaro commented

If you split a string that doesn't contained the passed in delimiter it will return the original string. In your example, the empty string is returned so the array has 1 entry (an empty string). Any string that you split that doesn't contain the delimiter will have the same result:

string("Test").split(",") returns Array[1]: [Test]

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.