Labview tutorial - How to determine whether a string contains numbers

Publisher:RadiantJourneyLatest update time:2014-11-03 Source: ck365Keywords:labview Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

String programming is one of the difficulties in Labview programming . Sometimes, it is common to spend a whole day to make a string processing VI, especially for special communication protocols and frame structures of various special equipment.

Let's start with the simplest unsigned decimal integer

1. Unsigned DEC integer

For example, the string "1234" obviously includes all numbers, not characters (such as A, B, C, etc.). The question is how to determine it in the program.

Unsigned decimal integers only contain 0, 1..9, so we can use the C language method to determine it using ASCII values. The ASCII value of 0 is 0X30, and
1..9 are 0X31..0X39 respectively. By converting the string into a U8 array, the U8 array stores the ASCII value of the character.



LABVIEW provides a node for determining decimal characters, IS DEC DIGIT?, which can be used to simplify the program. At the same time, it is a polymorphic VI. LABVIEW has a special example program to illustrate its use. It should be noted that for a string, it only determines the first character.

Look at the input type it accepts.



Therefore, a simpler method for determining decimal unsigned integers is shown in the figure below:



Similarly, LABIVEW also provides nodes for determining hexadecimal and 8-forbidden, so the above method can be easily used to determine whether it is a hexadecimal and octal digital string.

LABVIEW does not provide a method to determine whether it is a binary string, but you only need to change the above 0X39 to 0X31 to determine whether it is a binary string.

2. Determination of unsigned floating-point numbers

 . When comparing unsigned floating-point numbers, such as 1.234, with unsigned integers, you only need to determine whether it contains a decimal point. In addition, some integers use commas to represent the thousands separator, and similar methods can also be used to determine.



3. LABVIEW special type representation method
LABVIEW has several numerical representation methods


, so the judgment is very complicated, including the judgment of + - EKM, etc. The

following provides a general judgment method. Although it is general, the corresponding efficiency is relatively low. If you know the exact format, the above method is more appropriate.

You can directly judge +, -, scientific notation, SI, commas, etc.



 

Keywords:labview Reference address:Labview tutorial - How to determine whether a string contains numbers

Previous article:Labview tutorial on how to implement memory space sharing
Next article:Briefly describe the knowledge and understanding of virtual instrument technology and LabVIEW programming courses

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号