Converting item names to plaintext

dj_d

Member
What's a reliable way to convert item names to valid property names? Replacing spaces with underscores is a good start, but what about Genalen(tm) etc?
 

Bale

Minion
Make a regex matcher for alphanumerics and replace anything that doesn't match with an underscore. That'll work.

Alhifar, you're better with that sort of thing that anyone else I know. Do you want to knock out some quicky code for that? I'm pretty sure that dj_d once said he's not good with matchers and it takes me a little while (and a bit of trial-and-error) to get that sort of code just right.
 
Last edited:

jasonharper

Developer
It appears that a space is the only character you can't use in a property name; everything else should get properly encoded. A ™ shouldn't be any problem, other than perhaps difficulties in the user typing the name if needed.

All of the internally-used properties that refer to a specific item use the item's ID rather than name.
 
Top