mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2014
Posts: 2
B
Bowl of petunias
OP Offline
Bowl of petunias
B
Joined: Jul 2014
Posts: 2
Hey I'm currently trying to split a string and echo each portion of it to a new line.

Normally the usage of /n will force the next text onto a new line but doesnt seem to work. Is there any work around for this

I want the code below to echo this:
[Ant|Spider|Bullfrog]
to this:
Ant
Spider
Bullfrog

This code was basically trying to replace | with the required syntax to do so

Code:
if ($regsub(%section,/\|/g,$chr(32) $chr(124) $chr(32) $chr(47)n $chr(32),%section) > 0) {
      echo -a %section
}


Note Im using this in an alias.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
var %i = 1, %formatsection = $mid(%section,2,-1)
while ($gettok(%formatsection,%i,124) != $null) { 
  echo -a $v1
  inc %i
}


A regular expression seems like overkill here and will undoubtedly be slow to process.


Link Copied to Clipboard