LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string to number

i want A program that for each name (string) Give us a decimal number in labview,help me

0 Kudos
Message 1 of 15
(4,115 Views)
Please provide some details on what you want. For example, what sort of number should the name 'marii' return? Attach your code.
0 Kudos
Message 2 of 15
(4,114 Views)

if A=0

   B=1

   C=2

   .

   .

   .

   z=27

 

0 Kudos
Message 3 of 15
(4,090 Views)

@marii wrote:

if A=0

   B=1

   C=2

   .

   .

   .

   z=27

 


You are not telling us the "then". The "if" is not sufficient to define the problem.

 

Is each line a string? Are all lines a single multiline string?

0 Kudos
Message 4 of 15
(4,081 Views)

What happens in between?  There are only 26 letters, and if you start with a=0, then z would be 25.  How and where does z jump to 27?

0 Kudos
Message 5 of 15
(4,078 Views)

Why don't you try doing this yourself?  It is not at all clear to me what you want to do, anyway.  Have you taken a look at the String functions?  Do any of them (particularly the "conversion" functions) look like what you want?  Have you tried them?

 

It would appear that you are trying to learn LabVIEW.  The only way to learn a programming language is to write programs -- asking other people to do it for you won't teach you.  We will try to answer questions and provide help ...

 

BS

0 Kudos
Message 6 of 15
(4,040 Views)

By far the easiest way to do this is to type cast the string (assuming it's an uppercase single letter) to U8 and subtract 65.   This is something I would not expect a beginner to know, and it doesn't use any string functions....  

 

Granted, there's some assumptions on my part (uppercase, single letter). 

Message 7 of 15
(4,029 Views)

I think you are looking for the "String to Byte Array" function.

 

FROM help: unsigned byte array is the output array. The first byte in the array has the ASCII value of the first character in string, the second byte has the second value, and so on. 

 

So you take your Array and do -65 or -'A' te have a zero=A in your array.

Message 8 of 15
(4,011 Views)

The problem is still completey undefined. Here are some possible interpertations.

 

  • The incoming string is e.g. "A=1" and we want to parse the string after the equal sign into a numeric, assuming a decimal format.
  • The incoming string is e.g. "A" and we want to get the "1" according to the lookup table provided.
  • Something else entirely ...
  • ....

The quality of our answers cannot be better than the quality of the question. Please define exactly what you have and what you want.

 

Message 9 of 15
(3,912 Views)

i want to use case structure,

Determination the number of letters in the name,

Assign a number to name,

and Vice versa

0 Kudos
Message 10 of 15
(3,888 Views)