From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting string text to corresponding numbers

Solved!
Go to solution

Hello

im new to labview I've only been on it for a week and now I got stuck on trying to identify the alphabets with corresponding numbers like 

a=0 

b=1

c=2

d=3

.

.

and so on 

 

so that when a string is typed each alphabet can be converted to it's corresponding value depending on the description above like 

 

 

Hello 

 

will be 

 

7 4 11 11 14

 

I've tried a lot of ways that I found to be close to my requirement as a solution including match pattern function but it doesn't do it 

 

any idea? 

0 Kudos
Message 1 of 6
(2,312 Views)

Is this homework?

 

Show us one of the ways you tried that was close but didn't quite work.  There are probably dozens of ways to do it.  If you use byte array to U8, and subtract 64 from it, you are taking advantage of the ASCII table to solve the problem.  (or subtract 96 if they are lower case letters.)

Message 2 of 6
(2,309 Views)

Are you ignoring case (H = h)?  Can you post what you have tried so far?  How will you handle alpha-numerics?  Is that a concern?

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 3 of 6
(2,308 Views)

it is not a homework but a project in which im trying to hill encrypt a text to use the cipher as a key for one time pad to encrypt the same text again with it 

 

and this is as close as i could figure out to it, but it only gives me the location of the alphabet i type in 

0 Kudos
Message 4 of 6
(2,297 Views)
Solution
Accepted by topic author Atheer1122

Put indicators on all your wires, or watch it run with highlight execution on.  I don't think this will work if you are type in more than 1 letter.  (not "alphabet" which is the word for the entire group of letters.)

 

But for a single letter, it will give you the results in a sort of Rube Goldberg way.  (Well, you need to add 1 to the result.)

 

Example_VI

Message 5 of 6
(2,274 Views)

yes this works perfectly I just tried it thanks a lot 

0 Kudos
Message 6 of 6
(2,270 Views)