I want to execute an MySQL query with the channelname in the query, like join.php?chan=$chan.
All sounds pretty neat, but MySQL / PHP does not support the # sign.
My question is, how do I remove the # in front of the channel to execute the MySQL query:
Example
-----------
Bot is in #T-Xorcist
The query will be join.php?chan=#T-Xorcist
The query MUST be join.php?chan=T-Xorcist
% time {set chan [string trimleft #channel.name #]} 100
2 microseconds per iteration
% time {set chan [string map {# ""} #channel.name]} 100
4 microseconds per iteration
% time {regsub {#} #channel.name {} chan} 100
7 microseconds per iteration
First might make troubles when using with opnotices which target is @#channel, but if you want to strip then @# anyway, you will have no trouble with it.
.. and a whole 2 microseconds is going to be a total disaster? Good grief! DragnLord's solution is not only neater but cuts code length. I prefer neat and short code.
Add [SOLVED] to the thread title if your issue has been. Search | FAQ | RTM
Alchera wrote:
They depend entirely on the efficiency of the computer they are being tested on.
And I really can't see where microseconds will matter terribly (nor can I imagine a script where the exact same command is given in a procedure a hundred times in a row).