LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

alphabets to numbers

hi

i want to assing values to alphabets from A to Z as 0-15. like a=0 ,b=1 and so on ,

so that vn ever i give any word string like BALL it is converted to 101212 which is numeric

so plz if sme1 can help me out i am new to Labview

maak 

0 Kudos
Message 1 of 22
(4,394 Views)

The "String to Byte Array" function might more or less be what you're looking for. It converts a string to an array of U8 codes (ASCII codes). You can convert the string to lower/upper case before or subtract an offset from the result to better meet your needs.

 

http://zone.ni.com/reference/en-XX/help/371361D-01/glang/string_to_byte_array/

Message Edited by dan_u on 10-07-2008 11:09 PM
0 Kudos
Message 2 of 22
(4,384 Views)

You can try something along these lines here:

 

 

Message Edited by jmcbee on 10-07-2008 03:18 PM
Message Edited by jmcbee on 10-07-2008 03:18 PM
0 Kudos
Message 3 of 22
(4,380 Views)

maak,

 

Why not just use ASCII characters which are industry standard?  See here for a table of ASCII characters.  http://digital.ni.com/public.nsf/allkb/47CFD9C7682DCB2A86256FF800781EB7

 

 

Wow! Talk about being late for dinner.

Message Edited by centerbolt on 10-07-2008 05:14 PM
0 Kudos
Message 4 of 22
(4,378 Views)

SIR

i want to assign the fixed values from 0-25 to alphabets so wat ever is the input string it converts it to numbers as A to 0 b to 1 and if i write the sentence it convert it all in to number as the given values

thnx  

0 Kudos
Message 5 of 22
(4,352 Views)

maak wrote:

i want to assing values to alphabets from A to Z as 0-15. like a=0 ,b=1 and so on ,

so that vn ever i give any word string like BALL it is converted to 101212 which is numeric


This will not be very useful, because you cannot reverse the operation. 101111 could be BALL, JLL, BABBBB, JBBL, or many other variations. What is the purpose of this operation? Does it need to be reversible, or are you just trying to create a hash or similar?

 

It might make more sense to use 2 digits for each number, e.g. BALL=01001111. Please explain what you need.

Message Edited by altenbach on 10-07-2008 02:29 PM
0 Kudos
Message 6 of 22
(4,347 Views)
I must be misunderstanding you, the examples I provided will take a string, say "BALL", and convert that string to an output of 101111.  Is this what you are looking for?
0 Kudos
Message 7 of 22
(4,346 Views)
You've gotten enough information to write the code but I would also suggest that you might want to use the Format Into String instead of the Number to Decimal String. The Format Into String allows you to set a fixed width and pad with zeroes. That way, an A will translate as 00. No ambiguity when you use fixed widths.
Message 8 of 22
(4,342 Views)
A very good point Dennis K.  Kudos!
0 Kudos
Message 9 of 22
(4,337 Views)

yes sir u rite that is wat i want to do but i want to treat each alphabet spreatly than it will be more accurate

 

0 Kudos
Message 10 of 22
(4,336 Views)