Charmed Quark Systems, Ltd. - Support Forums and Community

Full Version: Question on Parsing a String in a CML Macro
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am playing with the Native Echo Smarthome Skill, and had a question on the best way to do this.

I have the following text string:  "{'channel': {'number': '100'}, 'channelMetadata': {}}"

I want to save the number shown (100) into a variable and discard the rest.  What would be the best recommended way to do so in a CML Macro?  I know I can do some splits, strips, and indexes and get to it in 4  or 5 commands, but was curious is there an easier way to capture that?  The Starting point will always be the same, but the number could be 1, 2, or 3 digits long.
My first stab at this was as follows:

                        DataParm.Cut(0,24);
                        DataParm.Split(TmpStr,''',False);

I guess that should suffice, but open for other ideas.
That's just JSON, so use the JSON parser and it'll do all of that for you.