|
Joined: Sep 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2003
Posts: 21 |
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: 150
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 150 |
that's the way it works $pos(meis is test,is,1) returns 3 $pos(meis is test,is,2) returns 6
/help $pos
Go ahead, jump. 100,000 lemmings can't be wrong.
|
|
|
|
Joined: Sep 2003
Posts: 29
Ameglian cow
|
Ameglian cow
Joined: Sep 2003
Posts: 29 |
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.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
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.
|
|
|
|
Joined: Sep 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2003
Posts: 21 |
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: 150
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 150 |
post your script so we can understand what r u trying to make
Go ahead, jump. 100,000 lemmings can't be wrong.
|
|
|
|
Joined: Sep 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2003
Posts: 21 |
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: 150
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 150 |
still does not make any sense...
Go ahead, jump. 100,000 lemmings can't be wrong.
|
|
|
|
Joined: Sep 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2003
Posts: 21 |
kk but the thing is i just wanna know how i can use a space in $cos
|
|
|
|
Joined: Sep 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2003
Posts: 21 |
ow damn i ment $pos instead of $cos (already edited my post)
|
|
|
|
Joined: Feb 2003
Posts: 10
Pikka bird
|
Pikka bird
Joined: Feb 2003
Posts: 10 |
//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.
return is the movement of sense.
|
|
|
|
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'.
$input(Me like stars, You too?)
|
|
|
|
Joined: Sep 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2003
Posts: 21 |
lmao, ty
|
|
|
|
Joined: Sep 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2003
Posts: 21 |
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
|
|
|
|
|