LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

specify string format

Hi

 

I'm looking for a way to specify the format of string without changing the information in the string.

 

Fx if I have a string which is displayed as "3100" in the normal display style, I would like it to be displayed as "3100" in the hexadecimal display style.

 

Thus I am not looking for a way to convert the data in the string but rather a way to specify format of the string.

 

Any smart way of doing this?

 

 

0 Kudos
Message 1 of 5
(2,731 Views)

I'm not understanding what you want. There is something like presentation of a string, which is the display style and the actual content of it. I don't see any other way of trying to do something about presenting a string.

 

A 4 byte string of the characters '3', '1', '0', '0' can not be displayed in hexidecimal view as 3100, which would be only two bytes, without throwing away data.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 5
(2,719 Views)

Seriously?

 

OK back to basics.  a "String" is really an array of unsigned bytes, U8s, or Characters.   each character is a number between 0 and 255 inclusive.  Thats all the computer knows about its value period!  

 

Now when we display the value of a string we have several options:

  • Display the ASCii representation of the array (Normal display)
  • Escape unprinable ASCii codes and show them as somethig else (New Line =ASCii 0x0A = 0b00001010 shown as "\n" for an example)
  • Show the value of the individual bytes using a convienient radix (Hexadecimal is convienient) 
  • show all characters as "*" regardless of the characters value

None of these display methods change the value of the charaters or the whole string

 

So asking for a string that displays [51, 49, 48, 48] as anything other than:

"3100" Normal

"3100" escape codes (No unprintable characters)

"3331 0000" Hex

"****" Password

 

Is really insane since [51, 49, 48, 48] ("3100" normal) is not equal to [ 49, 00] ("3100" Hex)


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 5
(2,708 Views)

Jeff·Þ·Bohrer wrote:

So asking for a string that displays [51, 49, 48, 48] as anything other than:

"3100" Normal

"3100" escape codes (No unprintable characters)

"3331 0000" Hex

"****" Password

 

Is really insane since [51, 49, 48, 48] ("3100" normal) is not equal to [ 49, 00] ("3100" Hex)


Except that "0" = 0x30.  So the hex display would be "3331 3030".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 5
(2,683 Views)

@crossrulz wrote:

Jeff·Þ·Bohrer wrote:

So asking for a string that displays [51, 49, 48, 48] as anything other than:

"3100" Normal

"3100" escape codes (No unprintable characters)

"3331 3030" Hex  {EDIT:Yup- thanks Tim.  my coffee pot was out earlier}

"****" Password

 

Is really insane since [51, 49, 48, 48] ("3100" normal) is not equal to [ 49, 00] ("3100" Hex)


Except that "0" = 0x30.  So the hex display would be "3331 3030".


 


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 5
(2,681 Views)