[Bro] str_split

Lorenzo Cavallaro sullivan at cs.ucsb.edu
Wed May 28 23:25:24 PDT 2008


Vern,

   thanks for the reply. I tried that before stucking on str_split.
   Unfortunately, I need to perform different operation depending on the
   character position that's why split_all didn't apparently give me any
   useful result. 

   Actually, the string is splitted but, if I got it right, the order of
   splitted chars is not guaranteed. Moreover, what are those empty
   slots?

TIA, bye
Lorenzo

On Wed, May 28, 2008 at 10:23:45PM -0700, Vern Paxson wrote:
> Given Christian's follow-on note, this might not be apt.  But from
> your original description, it sounds like split_all() will do the
> trick.  For example,
> 
> 	split_all("foobar", /./)
> 
> yields the table[count] of string:
> 
> 	{
> 	[10] = a,
> 	[6] = o,
> 	[11] = ,
> 	[7] = ,
> 	[4] = o,
> 	[1] = ,
> 	[9] = ,
> 	[3] = ,
> 	[5] = ,
> 	[8] = b,
> 	[12] = r,
> 	[2] = f,
> 	[13] = 
> 	}
> 
> which is enough to then iterate over each character.
> 
> 		Vern

-- 
Lorenzo `Gigi Sullivan' Cavallaro <sullivan at cs.ucsb.edu>
GPG key at http://security.dico.unimi.it/~sullivan/sullivan.asc

Until I loved, life had no beauty;
I did not know I lived until I had loved. (Theodor Korner)

See the reality in your eyes, when the hate makes you blind. (A.H.X)



More information about the Bro mailing list