|
glowack2 Newbie
Joined: 26 Oct 2002 Posts: 5 Location: USA
|
Posted: Tue Dec 09, 2003 4:46 am
Trouble handling doublequote character |
OK, I'm trying to work on a script that stores item names and stats in a database automatically. The problem is that some items have double-quotes in their names. Obviously " is a special character, but I can't seem to figure out the proper way to handle it in various situations: triggers, variables, the database, and echo.
With Zmud 6.66beta and #regex I can finally get the trigger to work and now " will show up in %1, and I'm able to assign them to a variable successfully. All good so far. Now we have
@ObjectName = Something "with quotes"
Then we try a few commands with the variable:
#echo @ObjectName
Outputs: Something with quotes
#addkey NewEQ Name {@ObjectName}
(or alternately without the {}, same thing happens)
@NewEQ now contains: Name = Something with quotes
Note that all the " are now missing... So how do I deal with this variable that has quotes? How do I get its contents into the database? Been pondering this one, reading the forum and help files, and there doesn't seem to be any information on it...
-ED |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Tue Dec 09, 2003 6:44 am |
Use the #VARIABLE method to assign things?
#VAR ObjectName {Something "with quotes"} |
|
|
|
glowack2 Newbie
Joined: 26 Oct 2002 Posts: 5 Location: USA
|
Posted: Tue Dec 09, 2003 4:36 pm |
I got it into the variable OK, when I look at the variable's contents in the GUI it shows the correct version with the double-quotes. I guess I should have been more clear that that particular step works. Once it's in the variable, the #echo and #addkey are the ones that don't seem to work properly.
-ED |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Tue Dec 09, 2003 6:07 pm |
Expand it with one level then.
#ADDKEY NewEQ Name %expand(@objectname,1) |
|
|
|
glowack2 Newbie
Joined: 26 Oct 2002 Posts: 5 Location: USA
|
Posted: Wed Dec 10, 2003 12:47 am |
OK, that seemed to work... Also had to do the same expand again when I do the call to #new to add the object to the database:
#new equipment_type %expand(@NewEQ,1)
All told, it looks like everything makes it properly all the way from the trigger into the database and back out again, so I think I'm all set... Thanks for the help! =)
-ED |
|
|
|
|
|