10-11-2013 09:15 AM - edited 10-11-2013 09:23 AM
I am stuck....trying to get the input numbers "1" and "0.23" into a string format result as "1:23",but instead I get a result of "1:0.23". getting rid of the "0." from the fractional number....
it must be my regex expression, can this be manipulated using regex without using extra functions? appreciate all the help this forum has given....
10-11-2013 09:28 AM
I don't see where you are using a regex. I see you using a format into string.
Why don't you just multiply the second number by 100 and format that into the string as %0.f;%0.f ?
10-11-2013 09:39 AM
@RavensFan wrote:
I don't see where you are using a regex. I see you using a format into string.
Why don't you just multiply the second number by 100 and format that into the string as %0.f;%0.f ?
well...the string format is time based. Meaning if the fraction is less than 10, I need the "09" (width of 2) to be inplace and not "9" for the seconds. You made a good point in my use of a format function, when I wanted a regex function?
10-11-2013 09:45 AM - edited 10-11-2013 09:45 AM
Apok,
Just do the math to get the "Time" elements to seconds and format into string as relative time (using the %<xxx>T specifiers)
10-11-2013 09:51 AM
@apok wrote:
@RavensFan wrote:
I don't see where you are using a regex. I see you using a format into string.
Why don't you just multiply the second number by 100 and format that into the string as %0.f;%0.f ?
well...the string format is time based. Meaning if the fraction is less than 10, I need the "09" (width of 2) to be inplace and not "9" for the seconds. You made a good point in my use of a format function, when I wanted a regex function?
I don't know which you actually want, I'm just commenting on what you are actually using versus what you say you are using.
If the two values are integers, then I would use %d as the format specifier. If you want it to be a width of 2 padded with zeroes, then it would be %02d. So I think you actually want "%d:%02d" as your format specifier. But you can work all that out if you right click the Format into String function and pick Edit Format String.
10-11-2013 10:09 AM - edited 10-11-2013 10:10 AM
@ Raven: thanks, that works....
@Jeff: Im confused...the input number does come in as total seconds, but trying to put that into a string as "M: SS". Can you illustrate your code in time format?
10-11-2013 10:22 AM
%<%M:%S>t for relative time in MM:SS
Use the format property page in advanced editing mode on a timestamp constant to play with time container format specifiers (the LabVIEW Help also contains the info but the prop page is a great place to play around and get a feel for those beasties)
This shows hours as well:
10-11-2013 10:55 AM - edited 10-11-2013 10:59 AM
i used both (Raven and Jeff) of your solutions in different parts of my code, MANY THANKS!...i wish i could make a 2 choice solution pick.
btw, my bad understanding..this was not a regex issue as Raven had pointed out "kudos"