I'm currently trying to convert a string with quotation marks into a proper for to be able to send to the server through a command. It's using a GUI but I can't seem to properly replace quotation marks to be able to be sent.
So let's say I have a string that is stored like this
%str = "Hello \"Bob\"";
and if you echoed %str it would display as
Hello "Bob"I am trying to make it so if you type something into a GUI text box like this
Hello "Bob" it'll properly put \'s into the string before them.
It's used for something like this
In the GUI lets say you type [i]you "suck" bob[/i] it would give me a syntax error because it thinks the quotation marks are for the command to server.
commandtoserver('tell', "Bob \"" @ GUIText.getValue() @ "\"");
I know something like this can be done another way with something with more parameters, but in the case of what I'm trying to achieve, I need to figure out how to do this.
I tried using
strreplace(%str, "\"", "\\\""); but that didn't seem to give me proper results and still came back with syntax errors.
Hopefully that is understandable. If not, I will find another way to do this. Thanks for any help I receive.