Nice solution, thank you! I hoped for something "easier" but I am beginning to understand that this is not a happy place for string manipulations :)
Nice solution, thank you! I hoped for something "easier" but I am beginning to understand that this is not a happy place for string manipulations :)
Sorry: Is there a better way to do such conversion? Are there any functions or librarys that could shorten the code?
Hy everybody, first post here so please have mercy π. I'll go straight to the question: I read from a file a string that represents with hex values a series of chars in a string examples: '41' => 'A'; '535458' => 'STX'. I have found the ugliest possible working code: PROGRAM PLC_PRG VAR sReadLine, sReverseString: STRING; udDBG: UDINT; pDBG: POINTER TO STRING; i: INT; END_VAR sReadline := '535458'; //corresponding string 16#535458 => 10#5461080 => stx sReadLine := concat('16#',sReadLine); //=>'16#535458'...
Hy everybody, first post here so please have mercy π. I'll go straight to the question: I read from a file a string that represents with hex values a series of chars in a string examples: '41' => 'A'; '535458' => 'STX'. I have found the ugliest possible working code: PROGRAM PLC_PRG VAR sReadLine, sReverseString: STRING; udDBG: UDINT; pDBG: POINTER TO STRING; i: INT; END_VAR sReadline := '535458'; //corresponding string 16#535458 => 10#5461080 => stx sReadLine := concat('16#',sReadLine); //=>'16#535458'...
Hy everybody, first post here so please have mercy π. I'll go straight to the question: I read from a file a string that represents the numeric hex values a series of chars in a string examples: '41' => 'A'; '535458' => 'STX'. I have found the ugliest possible working code: PROGRAM PLC_PRG VAR sReadLine, sReverseString: STRING; udDBG: UDINT; pDBG: POINTER TO STRING; i: INT; END_VAR sReadline := '535458'; //corresponding string 16#535458 => 10#5461080 => stx sReadLine := concat('16#',sReadLine); //=>'16#535458'...