Link to home
Start Free TrialLog in
Avatar of erzoolander
erzoolander

asked on

Javascript string to variables

Let's say I have a javascript string formatted like:

"var1='hello'&var2='value2'&var3='value3'" - is there a way for me to parse that/evaluate it turn that string into actual variables?

Thanks!
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Before we talk code - can you tell us what you want to do with the variables. There are different ways to solve this - if you explain your intention it will help to pinpoint what the right solution is.
Avatar of erzoolander
erzoolander

ASKER

I've got an app I'm writing that scans a barcode.  The barcode only can return text/a string - which I'm going to format as variables.  I need something that interprets the returned text - and then parses it out as the appropriate values.
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect!  Gracias!
You are welcome.