mIRC Home    About    Download    Register    News    Help

Print Thread
#47830 07/09/03 03:16 PM
J
JoWie
JoWie
J
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 laugh
grtz, Jo-W (sry about my bad english smile )

Last edited by JoWie; 07/09/03 03:20 PM.
#47831 07/09/03 03:34 PM
Joined: Jan 2003
Posts: 149
J
Vogon poet
Offline
Vogon poet
J
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

#47832 07/09/03 03:51 PM
M
MircMania
MircMania
M
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.

#47833 07/09/03 03:58 PM
C
codemastr
codemastr
C
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.

#47834 07/09/03 04:09 PM
J
JoWie
JoWie
J
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...

#47835 07/09/03 04:15 PM
Joined: Jan 2003
Posts: 149
J
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 149
post your script so we can understand what r u trying to make

#47836 07/09/03 04:25 PM
J
JoWie
JoWie
J
Code:
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.
#47837 07/09/03 04:42 PM
Joined: Jan 2003
Posts: 149
J
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 149
still does not make any sense...

#47838 07/09/03 04:43 PM
J
JoWie
JoWie
J
kk but the thing is i just wanna know how i can use a space in $cos

#47839 07/09/03 05:01 PM
J
JoWie
JoWie
J
ow damn i ment $pos instead of $cos (already edited my post)

#47840 07/09/03 05:50 PM
Z
z00ey
z00ey
Z
Code:
//echo # $pos(meis is test,$+($chr(32),is,$chr(32)),1)

..returns 5 (due to the space before "is").

Code:
//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 smile)



Last edited by z00ey; 07/09/03 07:04 PM.
#47841 08/09/03 05:54 PM
Joined: Dec 2002
Posts: 117
R
Vogon poet
Offline
Vogon poet
R
Joined: Dec 2002
Posts: 117
//echo # $pos(meis is test,$+(is,$chr(32)),1)
echoes 3 because of meis, 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:
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:
Code:
$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'.

#47842 08/09/03 08:06 PM
J
JoWie
JoWie
J
lmao, ty cool

#47843 08/09/03 08:09 PM
J
JoWie
JoWie
J
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 smirk


Link Copied to Clipboard