@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3



Comments:

<0> anc_ Sorry, no matches were found containing tv
<0> :P
<0> hmm.... i got strings like "20mb", the only regularity is that it starts with numbers.. what's the best way to extract those numbers into another var?
<1> use scan
<0> kewl... thx
<0> overlooked that
<0> hmm.. if I do like "%d%s" then 20 mb is not being processed correctly.. the second var becomes empty..
<0> s/not correctly/not what i want/
<2> string map {"mb" ""} $var
<0> nono.. I want to know it
<3> what the scan line yuor usin?
<0> scan $params "%d%s" amount quantity
<0> "skip to next white space" is s, so it's logical
<0> but i'm looking for a wayto say that white space between those is skipped
<3> hmmm
<3> surely it cant be that different, that often



<0> it should match things like 230 mb aswell as 39mb
<0> I could just strip out all space
<0> in front of the scan
<3> so i'm gonna ***ume you could just remove the white space
<3> yeah...
<0> :P
<3> scan ?
<4> scan -> http://www.tcl.tk/man/tcl8.4/TclCmd/scan.htm
<5> scan -> http://Tcl.Tk/man/tcl8.5/TclCmd/scan.htm
<0> smells not as good as hoped, but does the job
<3> or
<3> use some sort of regexp to choose which scan to use...
<0> regexp...
<0> ja
<0> lol
<3> lol
<0> can't I do back referencing from regexp like in perl?
<0> submatchvar
<0> problem solved
<0> regexp {^([0-9]*)\s?([a-zA-Z]*)$} $params amount quantity
<0> that gives me twice the same value
<3> lol
<0> 10 mb becomes 10 in amount and in quantity :S
<3> ;set params "40mb"
<5> [GRiMMY]: #142 (150 clicks) Tcl: 40mb
<3> ;regexp {^(.[0-9]*)\s?(.[a-zA-Z]*)$} $params amount quantity
<5> [GRiMMY]: #143 (41463 clicks) Tcl: 1
<3> ;regexp {^(.[0-9]*)\s?(.[a-zA-Z]*)$} $params amount quantity; puts $amount; puts $quantity
<5> [GRiMMY]: #144 (stdout) 40mb
<5> [GRiMMY]: #144 (stdout) 40
<5> [GRiMMY]: There's 4 lines, but I'm not gonna show you the rest of them! =P
<3> hm lol
<3> i hate regexp
<0> ;)
<3> ;regexp {^([0-9]*)\s?([a-zA-Z]*)$} $params amount quantity; puts $amount; puts $quantity
<5> [GRiMMY]: #147 (stdout) 40mb
<5> [GRiMMY]: #147 (stdout) 40
<5> [GRiMMY]: There's 4 lines, but I'm not gonna show you the rest of them! =P
<0> ; puts $amount; puts $quantity
<3> ;regexp {^([0-9]*)\s?([a-zA-Z]*)$} $params amount quantity; puts "$amount - $quantity"
<5> [next]: #148 (stdout) 40mb
<5> [next]: #148 (stdout) 40
<5> [next]: There's 4 lines, but I'm not gonna show you the rest of them! =P
<5> [GRiMMY]: #149 (stdout) 40mb - 40
<3> strange bot
<0> that's not what I get...
<0> ;set params "40 mb"
<5> [next]: #152 (141 clicks) Tcl: 40 mb
<0> ;regexp {^([0-9]*)\s?([a-zA-Z]*)$} $params amount quantity
<5> [next]: #153 (309 clicks) Tcl: 1
<0> ; puts $amount
<5> [next]: #154 (stdout) 40 mb
<0> what tcl version is this bot
<0> ;[info version]
<0> ;info version
<5> [next]: #156 (5590 clicks) Tcl error: bad option "version": must be args, body, cmdcount, commands, complete, default, exists, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, patchlevel, procs, script, sharedlibextension, tclversion, or vars
<0> ;info tclversion
<3> 8.4
<5> [next]: #157 (250 clicks) Tcl: 8.4
<0> same
<0> :S



<0> ;regexp {^(\d*?)\s?([a-zA-Z]*?)$} $params amount quantity
<5> [next]: #161 (1282 clicks) Tcl: 1
<0> ; puts $amount
<5> [next]: #162 (stdout) 40 mb
<0> just shoot me
<3> lol
<0> ; puts $quantity
<5> [next]: #165 (stdout) 40
<3> re_syntax ?
<4> re_syntax -> http://www.tcl.tk/man/tcl8.4/TclCmd/re_syntax.htm
<5> re_syntax -> http://Tcl.Tk/man/tcl8.5/TclCmd/re_syntax.htm
<0> was reading that yea
<3> lol
<3> regexp -inline -- {^(\d.*?)\s?([a-zA-Z].*?)$} $params
<5> [GRiMMY]: #169 (26917 clicks) Tcl: {40 mb} 40 mb
<3> regexp -inline -- {^(\d*?)\s?([a-zA-Z]*?)$} $params
<5> [GRiMMY]: #170 (317 clicks) Tcl: {40 mb} 40 mb
<3> regexp -inline -- {^(\d*?)\s?([a-zA-Z]*?)$} "40mb"
<5> [GRiMMY]: #171 (305 clicks) Tcl: 40mb 40 mb
<3> regexp -inline -- {^(\d*?)\s?([a-zA-Z]*?)$} "40 mb"
<5> [GRiMMY]: #172 (307 clicks) Tcl: {40 mb} 40 mb
<3> regexp -- {^(\d*?)\s?([a-zA-Z]*?)$} "40 mb" x y
<5> [GRiMMY]: #173 (341 clicks) Tcl: 1
<3> ;puts "$x - $y"
<5> [GRiMMY]: #174 (stdout) 40 mb - 40
<3> grmbl
<3> regexp -- {^(\d*?)\s?([a-zA-Z]*?)$} "40 mb" -- x y
<0> it's greedy :S
<5> [GRiMMY]: #176 (351 clicks) Tcl: 1
<3> ;puts "$x - $y"
<5> [GRiMMY]: #178 (stdout) 40 - mb
<0> what
<3> =)
<0> why
<3> lol
<0> regexp -- {^(\d*?)\s?([a-zA-Z]*?)$} "40mb" -- x y
<5> [next]: #183 (322 clicks) Tcl: 1
<0> ;puts "$x - $y"
<5> [next]: #184 (stdout) 40 - mb
<0> i hate you
<0> :P
<3> lol
<0> "Marks the end of switches."
<0> zucht
<3> lol
<0> regexp -- {^(\d*)\s?([a-zA-Z]*)$} "40mb" -- x y
<5> [next]: #191 (1400 clicks) Tcl: 1
<0> ;puts "$x - $y"
<5> [next]: #192 (stdout) 40 - mb
<3> does it work =P
<0> ok
<0> yeah
<0> thx
<3> so **** the manual =P
<0> yeah.. let's flush taht
<3> lol
<3> btw wanna know why it worked?
<3> regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?
<4> regexp -> http://www.tcl.tk/man/tcl8.4/TclCmd/regexp.htm
<3> MatchVar will be set to the range of string that matched all of exp
<3> =)
<0> aaaaaaaah
<3> so the -- makes it ignore it =P
<0> juh
<0> is that a magic varname? I mostly use something like "dummy" in such cases
<3> the --?
<0> juh
<0> the /dev/null of tcl
<3> no regexp just understands it as ignore, i think
<3> regexp -- {^(\d*?)\s?([a-zA-Z]*?)$} "40 mb" {} x y
<5> [GRiMMY]: #212 (344 clicks) Tcl: 1
<3> puts "$x - $y"
<5> [GRiMMY]: #213 (stdout) 40 - mb
<3> thats actually quicker


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #tcl
or
Go to some related logs:

#computers
#politics
#worldcup
#computers
#nhl
#gentoo
rf-transistor stuff
#gentoo
mirc slow paste
reflect failed to find getAwtLockFunctions.



Home  |  disclaimer  |  contact  |  submit quotes