Hi guys,
I want to write the time from GPS to the EB076 Display.
I can print number Hour_Byte then print ":" and Print Number Minutes_Byte and Print "." and then Seconds_Byte
But then I have to calculate the X and Y position for every print command.
Is there a simpeler way?
Something like this?
Display_Time_String=ToString$ (Hour_Byte) ":" (Minutes_Byte) "." (Seconds_Byte)
How would you guys do this?
Dutchie
String Manipulation Question
Moderator: Benj
- Dutchie_World_Wide
- Posts: 31
- Joined: Thu Jul 08, 2010 8:52 am
- Location: The Netherlands, or Thailand, or Gabon West Africa
- Has thanked: 4 times
- Been thanked: 3 times
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: String Manipulation Question
Hello Dutchie,
You could do something like this.
A better way might be to add leading 0's if the hour, min or second variable is less than 10 so you get a nice consistent display.
You could do something like this.
Code: Select all
Display_Time_String = ToString$(Hour_Byte)
Display_Time_String = Display_Time_String + ":"
Display_Time_String = Display_Time_String + ToString$(Minutes_Byte)
Display_Time_String = Display_Time_String + "."
Display_Time_String = Display_Time_String + ToString$(Seconds_Byte)
Code: Select all
Display_Time_String = ""
if (Hour_Byte < 10)
Display_Time_String = "0"
Display_Time_String = Display_Time_String + ToString$(Hour_Byte)
Display_Time_String = Display_Time_String + ":"
if (Minutes_Byte < 10)
Display_Time_String = Display_Time_String + "0"
Display_Time_String = Display_Time_String + ToString$(Minutes_Byte)
Display_Time_String = Display_Time_String + "."
if (Seconds_Byte < 10)
Display_Time_String = Display_Time_String + "0"
Display_Time_String = Display_Time_String + ToString$(Seconds_Byte)
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel