LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to remove empty char from a string

Hi,

 

In my code I should get numeric int numbers and convert them to 1 and 0 , concatenate thm to make an string ( 8 chars) . the problem I have is the empty chars as result of conversion from number to string

so lets say pxiAnaIn=1 dutVdd=2 and dutOut=5 so then the output should be 10110001 but now the output is 10110  1 . could you please let me know how can I fix this problem

thanks

 

 

 n.png

0 Kudos
Message 1 of 4
(2,183 Views)

Hi Tintin,

 

Use the Search and Replace function with the search set to " ".  The default replace string is "".

 

Regards,

Tom L.
0 Kudos
Message 2 of 4
(2,175 Views)

Use %02b and %03b (notice the zeros), this will zero pad your strings so they are the expected width.

Message 3 of 4
(2,165 Views)

@tintin_99 wrote:

Hi,

 

In my code I should get numeric int numbers and convert them to 1 and 0 , concatenate thm to make an string ( 8 chars) . the problem I have is the empty chars as result of conversion from number to string

so lets say pxiAnaIn=1 dutVdd=2 and dutOut=5 so then the output should be 10110001 but now the output is 10110  1 . could you please let me know how can I fix this problem

thanks

 

 

 n.png


You could make your life a little easier and only use 1 format string.  Use "%03b%02b%03b" for the format string.  You can then expand the format string to allow multiple inputs.  You will do the job of 4 functions with just 1.

 

"%3b" just says to give 3 spaces for the binary number.  But any preceding 0s will be turned into spaces.  Adding the 0 in there tells the format string to prepend 0s instead of using spaces.


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
Message 4 of 4
(2,159 Views)