r/Maxscript • • Sep 12 '18

Verbatim string in a Variable

Hey Guys!

I'm currently running into an issue with our database having an \r in the path name, and its destroying my importer paths when it attempts to reload them. Anyway to use a verbatim string @ + a variable? i don't see anything in the documentation.

thanks in advance!

2 Upvotes

4 comments sorted by

View all comments

Show parent comment

2

u/Swordslayer Sep 13 '18

That should still be safe - unless it's saved by enclosing the string itself by quotes. Either way, you can also use a .net function to do the escaping for you if you for some reason can't change the way it's stored:

dotNet.LoadAssembly "System.Web"
encode = (dotNetClass "System.Web.HttpUtility").JavaScriptStringEncode
--> now you can call 'encode path' on your path strings

1

u/[deleted] Sep 13 '18

Oh man thanks a lot! I will look into this for sure!