- HMI Model: cmt-fhxd-820
- EasyBuilder Pro Version: 6.10.01.510
Is there a way to parse a string/char within a macro?
Example:
char p1[0] = ‘FILERIGHT’
I need to grad the fifth character in the filed and place it into it’s own char variable.
Move “R” into → char p2[0]
Would these be like grabbing the array within the char?
Hi @outbound6 ,
To parse the string of p1 and grab “R” from the string please set up a p2 char array to hold the value. Then using the assigment operator we can access the value of “R” at p1[4] and place it within the zero index of 2.
The example below grabs the value of R from the p1 array and places it within LW 0.
Please let me know if you have any questions.
macro_command main()
char p1[20] = "FILERIGHT"
char p2[1] = ""
p2[0] = p1[4] // the fifth character is stored here
// and now p2[0] holds the fifth character and places it within LW 0
SetData(p2[0], "Local HMI", LW, 0, 1)
end macro_command