LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

number replaced by strings

Hi @ all,

how is it possible to replace numbers to strings like this:
Number String
1 ----> A
2 ----> B
3 ----> C
4 ----> D ....and so on!

If tried with the function "format value" but i've no idea, how i have to input the "Format-String"

Thanxs,

Ciao Thomas
0 Kudos
Message 1 of 7
(2,892 Views)
If you are just trying to have them in numeric order i.e. A=1, B=2, etc., then here is a simple example. Otherwise
you can build an array constant to provide a conversion table, where you can put them in whatever order you want, then either use the index as your number, or search the 1D array for your char. and the index will be returned. In my attached example, remember that lowercase are different numbers. If you want "a" and "A" to return the same number then remember to put the lowercase to uppercase conversion (found in the string section" in before the string to U8 conversion.


Putnam Monroe
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 7
(2,884 Views)
Oops, clicked too quickly.

Message Edited by LV_Pro on 06-02-2005 01:10 PM

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 7
(2,883 Views)
Hi,

thanks for quick help, but there is one problem. the numbers i get from an other function. There is only one input with one number between 0-26. In your solution i have to write it in any way in a Byte-array and than i can change it in a string. is there any other solution?

Thanxs again!

Thomas
0 Kudos
Message 4 of 7
(2,875 Views)
The attached shows how to convert 1->A, 2->B as your original question asked. With an input of 0, it will output the string "@" (ASCII 0x40). You didn't specify what you wanted 0 translated as but it would be an easy modification to whatever you want.
0 Kudos
Message 5 of 7
(2,869 Views)
Sorry now i have the solution for the array.

Thanxs for help!!!

Can you explain me why you add 64? Ascii-Table???

Ciao Thomas
0 Kudos
Message 6 of 7
(2,872 Views)

@thomla wrote:
Can you explain me why you add 64? Ascii-Table???


Yes. ASCII Table. A = 0d65 =0x41.

Edit: Oops.

Message Edited by Donald on 06-02-2005 01:47 PM

=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 7 of 7
(2,857 Views)