| View previous topic :: View next topic |
| Author |
Message |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sun May 10, 2015 8:16 am Post subject: string match spanish accents |
|
|
| Code: |
bind pubm - * who_emit
proc who_emit {nick uhost hand chan text} {
global dj
if {($text eq "Quien esta emitiendo?") || ([string match "Quien está emitiendo?" $text]) {
putmsg $chan "Emite Dj $dj"
}}
|
Not match the second condition for the accent "á"
| Quote: | <user> Quien esta emitiendo?
<bot> Emite Dj Roger
<user> Quien está emitiendo? |
Besides accents, you can be fixed to coincide with additional question marks?
ie:
Quien está emitiendo??
or
Quien está emitiendo????? _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sat May 16, 2015 1:56 am Post subject: |
|
|
I have fixed thanks to SpiKe^^
| Code: | proc who_emit {nick uhost hand chan text} {
global radiocanal nombreradio counf
if {$chan != "$radiocanal"} {return 0}
set who1 "Quien emite?"
set who2 "Quien está emitiendo?"
set who3 "Quien esta de dj?"
set whof "?"
if {(([lsearch -exact -ascii -nocase [lindex [split $text] 0 end] [lindex [split $who1] 0 end]] != -1) && ([llength [split $text]] == 2) \
&& ([string index $text end] == "$whof")) \
|| (([lsearch -exact -ascii -nocase [lindex [split $text] 0 end] [lindex [split $who2] 0 end]] != -1) && ([llength [split $text]] == 3) \
&& ([string index $text end] == "$whof")) \
|| (([lsearch -exact -ascii -nocase [lindex [split $text] 0 end] [lindex [split $who3] 0 end]] != -1) && ([llength [split $text]] == 4) && ([string index $text end] == "$whof")) } {
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
set dj [lindex $dj 0]
close $temp
}
putmsg $chan [encoding convertfrom utf-8 "Our current DJ is $dj"}
} |
The code is not case sensitive:
I added a counter along the string, so I did not take as correct portions thereof:
| Code: | | [llength [split $text]] == |
I also added that work if the text has a question mark at the end, not to take any text expression but leads that sign.
To make the text matched with Spanish accents, I used:
In this example, the current DJ database is:
_________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|