mIRC Homepage

Removing control codes

Posted By: AWEstun

Removing control codes - 04/07/08 02:22 AM

I'm trying to revent control code and the box (contrl-k) symbol in the string. This sort of works, but not always:

var %userbio = $strip($replacex($gettok($6-,-1,35),,),-burcmo)
Posted By: genius_at_work

Re: Removing control codes - 04/07/08 03:26 AM

$strip(%text) will remove ctrl+ b u r k o (asc: 2, 31, 22, 3, 15)

$strip(%text,b) will remove ctrl+b
$strip(%text,u) will remove ctrl+u

etc.

-genius_at_work
Posted By: AWEstun

Re: Removing control codes - 04/07/08 04:09 AM

This works:

var %userbio = $strip($gettok($6-,-1,35))

but how do I strip out the  (multiple) that are left.
Posted By: RusselB

Re: Removing control codes - 04/07/08 05:51 AM

Try
Code:
var %userbio = $gettok($6-,-1,35)
%userbio = $strip(%userbio)

In theory, what you have shouldn't have any of those control blocks in it, as the start and end control blocks for each part that is being stripped should be removed.
Posted By: AWEstun

Re: Removing control codes - 04/07/08 12:37 PM

That doesnt work either. Also tried:

$remove(%userbio,)

but that didnt work either.
Posted By: Miguel_A

Re: Removing control codes - 04/07/08 12:52 PM

Hi.

You need to ue the $chr(nr) off the character.
To know the nr off the $chr identifier you need to use $asc(character) them it will return a number... that number is to be used in $chr. Example:.

Code:
//echo -s $asc()
167
//echo -s $chr(167)



them $remove( text, $chr(nr))

good luck
Posted By: AWEstun

Re: Removing control codes - 04/07/08 01:34 PM

Originally Posted By: Miguel_A
Hi.

You need to ue the $chr(nr) off the character.
To know the nr off the $chr identifier you need to use $asc(character) them it will return a number... that number is to be used in $chr. Example:.

Code:
//echo -s $asc()
167
//echo -s $chr(167)



them $remove( text, $chr(nr))

good luck


I tried:

var %userbio = $strip($gettok($6-,-1,35))
var %userbio = $remove(%userbio,$chr(11))

but it's not removing the ctrl-k symbol.
Posted By: genius_at_work

Re: Removing control codes - 04/07/08 01:46 PM

$chr(11) is not the color control code.

ctrl+__

b= 2
u= 31
r= 22
k= 3
o= 15

Maybe the mutilated server you are on is using different control code characters.

-genius_at_work
Posted By: AWEstun

Re: Removing control codes - 04/07/08 02:43 PM

Originally Posted By: genius_at_work
$chr(11) is not the color control code.

ctrl+__

b= 2
u= 31
r= 22
k= 3
o= 15

Maybe the mutilated server you are on is using different control code characters.

-genius_at_work


It doesn't matter how F'd up the server is, as I'm extracting the infoline and trying to strip codes from with with mIRC.

11 is ctrl-k

source: http://www.nthelp.com/ascii.htm
Posted By: maroon

Re: Removing control codes - 04/07/08 03:58 PM

As he tried to tell you, $chr(11) is NOT the color code!

Try doing:

//echo -s $asc(x)

where you us the ctrl-K in place of the X, and you'll see that it returns 3 and not 11. The color code before the color number is $chr(3) Ctrl-C not the Ctrl-K you entered. You'll find that Ctrl-U puts in a $chr(31) not the $chr(21) you'd expect, etc.
Posted By: AWEstun

Re: Removing control codes - 04/07/08 04:36 PM

Originally Posted By: maroon
As he tried to tell you, $chr(11) is NOT the color code!

Try doing:

//echo -s $asc(x)

where you us the ctrl-K in place of the X, and you'll see that it returns 3 and not 11. The color code before the color number is $chr(3) Ctrl-C not the Ctrl-K you entered. You'll find that Ctrl-U puts in a $chr(31) not the $chr(21) you'd expect, etc.


Well, THANK GOD you jumped in and clearified his post! We need more people like you! Have you considered cloning and/or DNA storage?
© 2020 mIRC Discussion Forums