LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format Hex String

Solved!
Go to solution

Hi

This is a really easy question but I want final string to have only the first two digits (cut off all the 0's). I cannot figure out what is the correct format string to use..

Thanks

0 Kudos
Message 1 of 15
(4,680 Views)

Use the String to Byte Array on the String -> Conversion pallete.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 15
(4,667 Views)

I do not understand, can you show me an example?

Thanks

0 Kudos
Message 3 of 15
(4,655 Views)
Solution
Accepted by topic author mnanda98

Actually, instead of trimming the string, right click the "zero" constant you're using to change format and choose "Representation --> U8" and that's probably the best way.

 

Basically, one letter is one byte, and the zero constant you have there is an I32, which is 4 bytes, generating the extra 6 zeroes.

0 Kudos
Message 4 of 15
(4,648 Views)

That makes sense, but for another part of my code, I need to use string (just formatting a string, no conversions involved..)

Thanks

0 Kudos
Message 5 of 15
(4,640 Views)

@mnanda98 wrote:

I do not understand, can you show me an example?

Thanks


Edit:  Added snippet. 

Example_VI.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 6 of 15
(4,631 Views)

Thanks, but what if I do not want the spaces between the final string..?

0 Kudos
Message 7 of 15
(4,620 Views)

You could index thru the array using a FOR LOOP and concatenate all of the values together into one string using shift registers.  If you are unfamiliar with these terms, I would suggest going thru tutorial videos to learn the basics of Labview.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 8 of 15
(4,609 Views)

The default delimiter when working with Array to Spreadsheet String is Tab. You can't put an empty string, but you can replace all of the Tab values if you really want:

Spreadsheet U8 FP.png

 

You marked Kyle's answer as the solution, but keep in mind that that will only work if you have a single string character.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 9 of 15
(4,603 Views)

Just to un-rube your code a lot James.

 

HexString.png

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

Message 10 of 15
(4,573 Views)