05-18-2017 10:58 AM
So I have a shared variable string that sends something that looks like this:
"a = 1.0000E1
b= 2.0000E4 "
And so on. What function should I use to extract the number from a, so that I could read 1.0000E1?
05-18-2017 11:14 AM - edited 05-18-2017 11:15 AM
You could use "scan from string" and set the initial scan location at 3. If the string before the "=" can be longer, find its position and scan after it.
05-18-2017 11:18 AM
If the input string is multiline, something like this will give you an array of variables and an array of values.
05-18-2017 11:41 AM - edited 05-18-2017 11:41 AM
That is very close to what I am looking for! What if my variables aren't just a-z, but long complicated names? In the actual application, I have over 50, but I want to extract 5 of them, so could I just do %[var1,var2,var3,var4,var5] = %e in the search
05-18-2017 11:48 AM
That returns a string that contains those characters. If you want uppercase and/or digits, use "%[0-9a-zA-Z] = %e" as the format string.
05-18-2017 11:50 AM
Using the same front-end as aputman, you may need to search on the '=' sign if variable names change in size and content.
05-18-2017 12:12 PM
So I am attaching what I have so far. Say out of the variables, I want to only read a,c and variable_one. And this is always known, but the values way change. Can I have it so that it does that? ie "[a,c,variable_one] = %e" ?
05-18-2017 01:31 PM
05-18-2017 01:48 PM
You will need to split string on '=' if the string in the opening thread is correct. The variable name a is followed by a space where the next line with b has no space before the equal sign.
05-18-2017 01:56 PM
@ben64 wrote:
Use %s = %e
As long as there is a space between the name and the =, that will work. If not, then use %[^=]=%e. Personally, I would probably use the Match Pattern to find the = and then convert the After String (value) and keep the Before String (name).