01-20-2014 04:13 PM - edited 01-20-2014 04:14 PM
Does anyone know of a quick and elegant way to convert ASCII strings in the form of "\<some character>" to the corresponding byte value. For example, if I have the string "\n" I would like to convert it to the byte value of 0x0A. I realize I could brute force it with a case structure or a lookup table but I need to do this for all of the various escape character sequences. So far I haven't come up with a simple solution.
01-20-2014 05:18 PM
Look into vi.lib \Advanced String\ and peek at "Escape String.vi"
While it would be nicer if "Escapes" had an appropriate default value you at least get a frame to start from.
\vi.lib\Utility\config.llb also contains both an escape and unescape string function that are a bit more user friendly
01-20-2014 05:46 PM
@JÞB wrote:
Look into vi.lib \Advanced String\ and peek at "Escape String.vi"
This works but besides saving a bit of effort creating the lookup this does put me back to the case where I need to add all of teh various escape characters choices. As you mentioned, it would have been really nice if they had those set as the default.
Thanks.
01-20-2014 06:38 PM - edited 01-20-2014 06:39 PM
@Mark_Yedinak wrote:
@JÞB wrote:
Look into vi.lib \Advanced String\ and peek at "Escape String.vi"
This works but besides saving a bit of effort creating the lookup this does put me back to the case where I need to add all of teh various escape characters choices. As you mentioned, it would have been really nice if they had those set as the default.
Thanks.
That is why I also pointed out \vi.lib\Utility\config.llb\ Escape String.vi and Unescape String.vi. They are a bit rough on the eyes but better than re-inventing the wheel.