Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
GrimofDC
Beginner


Joined: 14 Jul 2002
Posts: 18

PostPosted: Thu Aug 29, 2002 4:37 pm   

How do I remove quotes
 
Hello everyone,

I'm trying to remove single quotes and double quotes from a string.

The trigger does something like this (mine is really bulky so I didn't post it here):

#TR {(%*)has arrived.} { name = replace(%replace(%1,"'"," "),'"'," ") }

however this doesn't work, or I'm missing something. I just need to get whatever %* is to have only alphbetical characters. No special characters of any kind. Thank you for reading this.

~Grim
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Thu Aug 29, 2002 5:50 pm   
 
Your missing a %, but I think that may have just been a copy error on your part.

#TR {(%*)has arrived.} { name = %replace(%replace(%1,"'"," "),""," ") }

Also, to remove the double quote, try placing 2 double quotes together. If that does not work you may need to use a variable.

Create a new variable called doubel-quote and place a double quote in its value and default value field. Then do the following:

#TR {(%*)has arrived.} { name = %replace(%replace(%1,"'"," "),@double-quote," ") }


Talahaski
Processor PIII 1000
Memory 265MB
Video NVIDIA 64MB
Windows XP
Zmud Version 6.34
Zmapper Version 1.10
Reply with quote
GrimofDC
Beginner


Joined: 14 Jul 2002
Posts: 18

PostPosted: Thu Aug 29, 2002 8:33 pm   
 
I'm getting the same results when using a varable with the value of " and when I just type %replace(@whatever,'"'," ")

If @whatever = Test"test the output is Test"test

If @whatever = Test"te"st teh output is Testtest

It's not really following the %replace function. If it did there would be two spaces. Like this, Test te st

Works fine with single quotes, but haven't a hard time getting double quotes filtered out. If anyone knows how please reply, thank you.

~Grim
Reply with quote
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Thu Aug 29, 2002 8:38 pm   
 
From the zMUD help files:

stripq

Syntax: %stripq(s)

Removes the internal quotes from the string s. This is provided for backwards compatibility with older versions of zMUD. In older versions, internal quotes passed to functions were automatically removed. In newer versions, only the outside quotes are removed. The %stripq function can be used to emulate the behavior of older versions of zMUD.
Examples:
To show exactly what is passed to a function, the follow test function is created:

#FUNC test {%literal(%1)}

This will return the argument of the function exactly as passed without further parsing.

a=123
#SHOW @test("@a"@a"@a")

returns @a"@a"@a because the newer version treats this entire argument as a string, so no variable expansion is performed.

#SHOW @test(%stripq("@a"@a"@a"))

returns "@a123@a" where the internal quotes have been stripped, and since the internal section is not between quotes, the variable reference is expanded by the function call itself.

Fat Tony
Reply with quote
GrimofDC
Beginner


Joined: 14 Jul 2002
Posts: 18

PostPosted: Thu Aug 29, 2002 9:05 pm   
 
I'm not finding the %stripq function in my helpfiles. I'm using version 6.16 until the next version of zMud comes out. I'd rather not use the beta because I've heard it can mess up your commands file. Thanks for the reponse, I'm sure you just helped out a lot of Beta version users.

If anyone has figured out how to do this in zMud6.16 I'd really appreciate it.

Thanks again,

~Grim
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Aug 29, 2002 9:59 pm   
 
#TR {(%*) has arrived.} { name=%remove("has arrived",%quote(%trigger));name=%replace(@name,"'"," ");name=%replace(@name,%char(34)," ")}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net