Re: left, right? head, tail? which one?
- Posted by Jeremy Cowgar <jeremy at cow?ar.co?> Apr 25, 2008
- 723 views
Jason Gade wrote: > > Some of these forms already have an idiom in Euphoria (left, right). The pad > and trim stuff might be useful, I'm not sure. I kinda agree with Matt up > above. Can you give me an example of how you would do:
sequence s s = head({1,2,3,4,5}, 3) -- {1,2,3} s = head({1,2}, 55) -- {1,2} s = head("John Doe", 30) -- "John Doe" s = head("John Doe" 3) -- "Joh"
I do a lot of string processing and checking length each time is the pits, thus most languages provide some form of left, right, mid that do bounds checking. [1..3] will not work. [3..$] will not work. In regards to trim and pad... yes, in string processing they are very helpful, again, the reason that most languages (even python as stated previously) have them. > Jeremy, have you looked into Kat's strtok library? I have it downloaded, but I have not got into the section yet of the standard library of string tokenizing so I have not spent any real time with it. -- Jeremy Cowgar http://jeremy.cowgar.com