infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Cloverleaf
@time removing colons from the strinf
System
Originally posted by Manny Zachodin
The format of
@time
is HH:MM:SS. How can I convert the format to HHMM (without the colon).
Find more posts tagged with
Clovertech
Comments
System
Originally posted by Michael Lacriola
Here's one method:
tcl>echo $t
10:35:36
tcl>regsub -all -- ":" $t {} newT
2
tcl>echo $newT
103536
tcl>set newT [csubstr $newT 0 4]
tcl>echo $newT
1035
tcl>
System
Originally posted by Michael Lacriola
andanother...a little more cryptic...
tcl>echo $t
10:35:36
tcl>regsub -all -- ":" [csubstr $t 0 5] {} newT
1
tcl>echo $newT
1035
System
Originally posted by Manny Zachodin
Can I invoke this small routine in xlate?
Jim Kosloskey
Manny,
Here is another:
set whatsis [string map {: ""} "10:25:30"]
echo $whatsis
102530
The string command is finding more favor these days since (according to Charlie Bursell and the other Tcl wizards) string is highly optimized.
I also find many of the string commands easier to use.
Oh and you can do this in an Xlate.
I prefer not to imbed the code directly but rather invoke an external xltp type proc. This allows me to construct reusable code and eliminates the annoyance of when I misplace a curly brace or square bracket and get debug information which gives me everything I don;t want to know about the Xlate and always seems to stop short of telling me where in my code Tcl had objections.
Mos timportant to me is the reusable code. Then the next time I need to do a string map, I just change the arguments to the proc. Non Tcl proficient folks can use the facility as well.
Jim Kosloskey