[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: String tokenization function
- From: Marco Atzori <marco.atzori.1983@...>
- Date: Sat, 7 Nov 2015 21:57:15 +0100
Il 07/11/2015 19:25, Dirk Laurie ha scritto:
Really sorry for my "bad" answer, I was in a hurry and did not read
carefully your answer. Thanks for the tips, and I still ask pardon for first
2015-11-07 20:05 GMT+02:00 Marco Atzori <email@example.com>:
Il 07/11/2015 18:54, Dirk Laurie ha scritto:
local s = tokens( "apple.banana.cherry.grape.orange",".")
Because 46 is the ASCII code of the dot. If I want, for example, tokenize
the string with another character (which can be a letter, number, comma,
semicolon, hash or any ASCII character from 1 to 255) with your code this is
not possible because it is limited to only dot as a separator between
local text = "Roses-are-red-violets-are-blue"
As you can see, your code is unable to get "violets", when you just need
enter 45 instead of 46.
I paid your question the compliment of actually implementing and
testing my answer. It is a disappointment that you have summarily
dismissed that answer without bothering to read it carefullly.
s = tokens("Roses-are-red-violets-are-blue","-")