mIRC Home    About    Download    Register    News    Help

Print Thread
#114685 16/03/05 09:14 PM
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
i've got a string and i need to replace all spaces by _
$replace(%value,$chr(160),_)
doesn't work (seems to me)

#114686 16/03/05 09:22 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
alot of people seem to be using 160 lately. Please use $chr(32)
160 is not a space in all fonts smile


$maybe
#114687 16/03/05 09:30 PM
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
Thanks

#114688 16/03/05 09:39 PM
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
if ( !%wzl-trivia_cleaned_ $+ $replace(%value,$chr(32),_) ) {
set %wzl-trivia_cleaned_ $+ $replace(%value,$chr(32),_) 1
echo %wzl-trivia_cleaned_ $+ $replace(%value,$chr(32),_)
}
returns as echo:
gestopt
%value=gestopt
it should return 1 off course
whats wrong???
the var sets itself correctly (%wzl-trivia_cleaned_gestopt 6426)

question clear enough? smirk smile

#114689 16/03/05 09:42 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
if (![color:red]$($+([/color]%[color:red],[/color]wzl-trivia_cleaned_[color:red],[/color]$replace(%value,$chr(32),_)[color:red]),2)[/color]) {
  set %wzl-trivia_cleaned_ $+ $replace(%value,$chr(32),_) 1
  echo [color:red]$($+([/color]%[color:red],[/color]wzl-trivia_cleaned_[color:red],[/color]$replace(%value,$chr(32),_)[color:red]),2)[/color]
}


New username: hixxy
#114690 16/03/05 10:24 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019

var %a = $+(%,wzl-trivia_cleaned_,$replace(%value,$chr(32),_))
if !$(%a,2) { inc $(%a) | echo $(%a,2) }


Gone.
#114691 17/03/05 08:16 PM
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
Thanks a lot!!!, solved the problem with a combination of your answers.

#114692 17/03/05 09:17 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Quote:

alot of people seem to be using 160 lately. Please use $chr(32)
160 is not a space in all fonts


That's because when you type several consecutive spaces into the Scripts Editor, only the first space is recognized; all spaces that follow are ignored.

That's why we use $chr(160) to force blank spaces in our scripts.

In LethPhaos' situation indeed a $chr(32) was needed but this is $chr(32) Vs. $chr(160)

Code:
//echo -a $str($chr(32),6) Hello | echo -a $str($chr(160),6) Hello


Using this will align the second Hello (with $chr(160)) starting the H below the o from the first Hello (without $chr(160))

//echo -a Hello $+ $chr(32) $+ world!

Returns Hello world!

//echo -a Hello $+ $chr(160) $+ world!

Returns Hello world!

//echo -a Hello $+ $str($chr(32),2) $+ world!

Returns Hello world! (but with only one space)

//echo -a Hello $+ $str($chr(160),2) $+ world!

Returns Hello world! (but with 2 spaces)

Last edited by SladeKraven; 17/03/05 09:19 PM.
#114693 18/03/05 04:28 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
He knows that 0160 is a hard space in a lot of fonts, but what you must understand is that 0160 isn't a hard space in all fonts, in a lot it isn't.

Type //echo -a a $chr(160) b

in your status window, and then change your font to Terminal. You'll see what he's referring to.

The point is, if you use $chr(160) in your scripts, and those strings are outputted to a channel fex, it may not appear to everyone as it appears on your font.

Greets


Gone.

Link Copied to Clipboard