| View previous topic :: View next topic |
| Author |
Message |
lacedrabbit Voice
Joined: 25 Sep 2007 Posts: 3
|
Posted: Wed Oct 03, 2007 9:25 am Post subject: trimleft and other string problems |
|
|
Hello There,
i have read nearly every forum post relating to this problem
ive search and everything, heres my problem
I've logged a chan output to logfile, i've brought it back in
gave it a string and everything, worked out how to strip the colors from it
heres the code i have..
| Code: |
if {[file exists $searchfile]} {
set filech [open $searchfile r]
while {![eof $filech]} {
gets $filech line
set edline $line
set edline2 $line
set endofname "x"
set lwrtext [string tolower $text]
set lwrcase [string tolower $edline]
set strip [stripcodes bcruag $edline2]
if {[string match *$lwrtext* $lwrcase] && [string match *#* $edline] } {
puthelp "PRIVMSG #melwakechan : Result - [string trimleft $strip "#"] -"
}
}
}
close $filech
|
from my view point I can't see why it doesn't take info out of the output
this is just my final way of coding it, I have tried many, all of which failing
finding the line is not the problem here, what I want to do is format the line so I can do something useful with it. this is just the start of this application, but it doesn't make any sense at all to me..
Even a Your making no sense here would be appreciated
this is what I am getting in the channel, I would have thought from my reading that everything to the left of the # would be gone,or even just no #.
| Quote: |
Result - [03:05] <[am]-32263> #4 1x [705M] Oceans.13.R5.Line.XViD-ViSUAL.avi -
|
Thanks.
lacedrabbit |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Wed Oct 03, 2007 2:17 pm Post subject: |
|
|
| Quote: | | if {[string match *$lwrtext* $lwrcase] && [string match *#* $edline] } { |
I think you should try:
| Code: | | if {[string match -nocase $lwrtext $lwrcase] && [string match -nocase *#* $edline] } { |
and use
* in $lwrtext
for Example:
| Code: | | set lwrtext { "*text1*" "*text2*" "*text3*" } |
Then use it in proc and don't forget to take it into Global
| Code: | | foreach lwrtext $lwrtext { if {[string match -nocase "$lwrtext" $lwrcase] && [string match -nocase *#* $edline]} { |
I am not sure about it but once I had the same problem I solved it with that.
Thanks
iamdeath _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
lacedrabbit Voice
Joined: 25 Sep 2007 Posts: 3
|
Posted: Wed Oct 03, 2007 6:18 pm Post subject: |
|
|
Ok, heres a tidied up version - thanks 'iamdeath'
| Code: |
if {[file exists $searchfile]} {
set filech [open $searchfile r]
while {![eof $filech]} {
gets $filech line
set edline $line
set strip [stripcodes bcruag $edline]
if {[string match -nocase *$text* $edline] && [string match -nocase *#* $edline] } {
puthelp "PRIVMSG #melwakechan : Result - [string trimleft $strip "#"] -"
}
}
close $filech
}
|
although your advice helped tidied up my code, and I am grateful,
but I still have the output problem, I would like to get rid of the text to the left of the '#'
| Quote: |
Result - [17:10] <Jory`> #11 «701 MB» Wrong.Turn.2.LIMITED.DVDSCR.XViD-mVs - (4 gets) -
|
does anyone know of a good url for reference for string manipulation as every sight I have read says this should be working. |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
|
| Back to top |
|
 |
|