c_w_k Posted March 30, 2010 Report Share Posted March 30, 2010 Hello, I'm trying to figure out a way to parse a number in labVIEW. I will have a number that ranges from 101 to 416 and I need to separate the first digit from the last two digits of the number. So far the only way I can think if is to determine if the number is in the 100, 200, 300, or 400 range and then subtract that from the the input, so for example if my number is 416 then I can determine that it is greater than 400 so I would then know to subtract 400 from my number so 416-400=16 so that gives me the last two digits. Is there a better way of doing this? Thanks CK Quote Link to comment
Black Pearl Posted March 30, 2010 Report Share Posted March 30, 2010 If you have a string (otherwise just convert the number to a string), you can split the string after the first character and then convert it back to a number. Felix Quote Link to comment
asbo Posted March 30, 2010 Report Share Posted March 30, 2010 You could divide the number by 100 and use the quotient (integer result) of the operation. 2 Quote Link to comment
Black Pearl Posted March 30, 2010 Report Share Posted March 30, 2010 asbo: You mean using the Quotient & Remainder? That's elegant! Felix Quote Link to comment
asbo Posted March 30, 2010 Report Share Posted March 30, 2010 asbo: You mean using the Quotient & Remainder? That's elegant! Ahh - that's what it's called! I knew LV used something other than division for the node. Yes, that's the one Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.