LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i convert an ascii character to a number?

where can I find the function?
0 Kudos
Message 1 of 8
(3,542 Views)


Message Edited by mathan on 06-27-2008 01:33 AM
0 Kudos
Message 2 of 8
(3,541 Views)
no use
0 Kudos
Message 3 of 8
(3,533 Views)
Hi roverboy,

when it's only one char you can use "typecast" to convert to an U8 number. Or you take "string to U8 array" and pick the first element...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 8
(3,527 Views)

A string will be converted to an array of U8.

Unless you convert a single character.

RayR



Message Edited by JoeLabView on 06-27-2008 05:39 PM
Download All
Message 5 of 8
(3,495 Views)


roverboy wrote:
where can I find the function?

Well, yur question is not clear at all, for example if the ASCII character is 0..9, it already IS a number! 🙂
 
You need to define what kind of number you want. A typical use would be to convert it to the U8 number that has the same bit pattern as the character. In this cas you would typecast it to a U8. Anyway, from your question it is not clear what you need, so please be more specific.
 
Give an example!
If the ASCII charcter is "1", should the output be decimal 1 or 49? BIg difference, but both could be correct depending on what you actually want.
 

 
Message 6 of 8
(3,482 Views)
thanks all people here ,the question are solved,the good method is  JoeLabView's  and GerdW 's.
Message 7 of 8
(3,447 Views)

Glad to help.

🙂

0 Kudos
Message 8 of 8
(3,440 Views)