|
JoWie
|
JoWie
|
i have a prob, if i do $pos(meis is test, is ,1) it returns 3, so mirc ignores the spaces in the string. Is there a way to make mirc not ignore the spaces so it would show up 6? (i use it in a script, so N is always 1) and yes i did a search but that still answered my question... and i know " meis" isnt a word grtz, Jo-W (sry about my bad english  )
Last edited by JoWie; 07/09/03 03:20 PM.
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
that's the way it works $pos(meis is test,is,1) returns 3 $pos(meis is test,is,2) returns 6
/help $pos
|
|
|
|
MircMania
|
MircMania
|
You could resort to using the $mid(%text,%number,4) identifier, you could increment the number until the end of the file and check for each four letters whether they equalled chr(32) $+ is $+ chr(32). If they do, you will know the %number you are on.
|
|
|
|
codemastr
|
codemastr
|
Or you could just use $findtok. $findtok(this is my test,is,1,32) If I understand what he is saying, that should do what he wants.
|
|
|
|
JoWie
|
JoWie
|
Joke wrote: ---------------------------- that's the way it works $pos(meis is test,is,1) returns 3 $pos(meis is test,is,2) returns 6
/help $pos
----------------------------
the N is always 1 in my script...
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
post your script so we can understand what r u trying to make
|
|
|
|
JoWie
|
JoWie
|
alias NEW {
set %is-item $$1
set %is-value $$3-
echo -s %is-item == %is-value
}
This is my code, now if I do /new testing blah is testing blah123 I get testing == blah testing blah123 so i tryd to make with the $pos to return the number where "is" is, then i used $left with the number from $pos. Only then if i do "/new 324092is is testing" i get "324092"
Last edited by JoWie; 07/09/03 05:01 PM.
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
still does not make any sense...
|
|
|
|
JoWie
|
JoWie
|
kk but the thing is i just wanna know how i can use a space in $cos
|
|
|
|
JoWie
|
JoWie
|
ow damn i ment $pos instead of $cos (already edited my post)
|
|
|
|
z00ey
|
z00ey
|
//echo # $pos(meis is test,$+($chr(32),is,$chr(32)),1)
..returns 5 (due to the space before "is").
//echo # $pos(meis is test,$+(is,$chr(32)),1)
..returns 6 like you want it to.. (btw, i agree, strange coding but i hope it helps you, whatever you re doing, lol  )
Last edited by z00ey; 07/09/03 07:04 PM.
|
|
|
|
Joined: Dec 2002
Posts: 117
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 117 |
//echo # $pos(meis is test,$+(is,$chr(32)),1)echoes 3 because of me is, please test code before posting it, especially when it is this easy to test. If you just want to split the text into the part before and after 'is' use this code: alias new {
var %pos = $findtok($$1-,is,1,32)
var %is-item = $gettok($1-,1- $+ $calc(%pos - 1),32)
var %is-value = $gettok($1-,$calc(%pos + 1) $+ -,32)
echo -s %is-item == %is-value
} If you really want the position of the 'i' character from 'is' try this: $calc($len($gettok($1-,1- $+ $calc($findtok($1-,is,1,32) - 1),32)) + 1) That will return the number of characters(including the space in front of 'is') before the word 'is'.
|
|
|
|
JoWie
|
JoWie
|
lmao, ty
|
|
|
|
JoWie
|
JoWie
|
please test code before posting it, especially when it is this easy to test. ---------------------- you dont get my question, i asked because it went rong when i whas testing
|
|
|
|
|