Example Code

String to U8 Numbers Function Comparison using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview
This VI demonstrates three functions that strings are converted to a U8 number.

 

Description
Here is a brief description of the example:

This example code exhibits the ways that strings are converted to a U8 number by three functions:

  1. Decimal String to Number reads the string as a number. If the input string is not a number, function outputs 0.
  1. Type Cast determines the decimal ASCII code of the first digit or character.
  1. String to Byte Array

String to Byte Array determines the decimal ASCII code of each character in the string.

 

Requirements

  1. LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Type the number in the control Number as String.c
  2. Run the VI
  3. Display three functions, such as Decimal String toNumber, Type Cast to U8 and String to Byte Array

 

Additional Information or References

VI Snippet

String to Number 2012 NIVerified.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**


Mark E.
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Todd S.
NI Employee (retired)
on

Thanks for posting!

Todd S.
LabVIEW Community Manager
National Instruments