1. strtok-v2.e addition

sorttok() is added now:

string = {"Red,Skelton,45,London,England",
          "Lucy,Ball,56,Barre,North Dakota",
          "Fred,Astaire,45,Alberta,Canada",
          "Pierre,du Pont,56,Paris,France"}

string = sorttok(string,{3,-2},',') 
-- sort by field3, then by reverse field2

string = {"Red,Skelton,45,London,England",
          "Fred,Astaire,45,Alberta,Canada",
          "Pierre,du Pont,56,Paris,France",
          "Lucy,Ball,56,Barre,North Dakota"}


Kat

new topic     » topic index » view message » categorize

2. Re: strtok-v2.e addition

On 13 Jul 2002, at 8:32, Kat wrote:

> 
> sorttok() is added now:
> 
> string = {"Red,Skelton,45,London,England",
>           "Lucy,Ball,56,Barre,North Dakota",
>           "Fred,Astaire,45,Alberta,Canada",
>           "Pierre,du Pont,56,Paris,France"}
> 
> string = sorttok(string,{3,-2},',') 
> -- sort by field3, then by reverse field2
> 
> string = {"Red,Skelton,45,London,England",
>           "Fred,Astaire,45,Alberta,Canada",
>           "Pierre,du Pont,56,Paris,France",
>           "Lucy,Ball,56,Barre,North Dakota"}

sortntok() is also working now.

Question: what is the best way to rename these for case-insensitivity?:

parse
deparse
matchtok
matchntok
wildtok
wildntok
findtok
gettok
addtok
puttok / changetok
reptok / repltok
sorttok
instok
istok
remtok
deltok
sortntok

Kat

new topic     » goto parent     » topic index » view message » categorize

3. strtok-v2.e addition

Ok, since i recieved no feedback on adding case-insensitivity to the strtok 
library, i am adding it like this:

string = "a1 cat1 ba Cat1 da tac2"

findtok(string,"Cat1",{1},32) = 4
findtok(string,"Cat1",1,32) = 4
findtok(string,"Cat1",{"i",1},32) = 2 

This makes the flag optional and doesn't break anything. So far, matchtok, 
matchntok, wildtok, wildntok, and findtok can ignore the case of token and 
string. Webpage and zip file are updated. Comments are welcome.

Kat
http://www.pell.net/warning/euphoria.html

new topic     » goto parent     » topic index » view message » categorize

4. Re: strtok-v2.e addition

Kat writes:
> Rob, how much time is spent on type checks?

User-defined type-checks involve a subroutine call
and usually a couple of comparisons. If you say:
     without type_check
they won't happen.

If you are worried about performance,
you should try:
     with profile
or
     with profile_time
to see where the bottleneck really is.
It's quite often not where you expect.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: strtok-v2.e addition

{{{ On Thu, 18 Jul 2002 19:47:01 -0400, Robert Craig <rds at RapidEuphoria.com> wrote:

User-defined type-checks involve a subroutine call
and usually a couple of comparisons. If you say:
without type_check
they won't happen.

DOH! AGAIN! I seem to be always repeatedly frightened off using Eu types 'cos I stupidly forget you can switch the (obvious) performance hit off once it all works.

It is a pretty cool concept though, I remember in the decipher contest coding a result type (or five) which trapped the program at near enuf the exact point it made a mistake...

(And yes, I remember hacking thru the code at 2am taking it all out..) </DOH> </AGAIN>

Pete

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu