# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Number split in separate Digits

Hi,

i have a Number like 156 this Integer i want split in integer 1, 5 and 6. How i can make this?

I need this number separate because i have three 7 Segments.

Somebody a idea?

Message 1 of 6
(5,406 Views)
Solution
Accepted by topic author Saiz

## Re: Number split in separate Digits

Format into String and use each character individually using other string function in the palette.

Use quotient and remainder and divide by 10.  The remainder will be the units digit.

Repeat with the quotient in a loop to get the 10's digit, 100's digit.

Message 2 of 6
(5,398 Views)

## Re: Number split in separate Digits

Sorry forgot to say i need this on FPGA. So no string is available.

Message 3 of 6
(5,383 Views)

## Re: Number split in separate Digits

You probably need to do a few checks to make sure the number really fits into the number of digits so you don't display values that have little to do with the number. For example an input of 1000 should return 999, not 000. Of course there are other possibilities to handle it, but it needs to be handled unless you can guarantee that the input value never exceeds 3 decimal digits.

Here's one possibility (you can adapt it for FPGA):

Message 4 of 6
(5,348 Views)

## Re: Number split in separate Digits

Divide the number with 10 until the quotient becomes zero. The reverse of remainder array will be the desired array of separate digit.

Hope that helps!

Message 5 of 6
(1,113 Views)

## Re: Number split in separate Digits

Sorry Dharsen, but Altenbach's answer is 30-40 mSec faster than yours.  And 5 years sooner too!  😁

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 6 of 6
(1,082 Views)