|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Date and Time Calculation > DTO. - Date Time Operations > Date & Time Operations |
MiniRobotLanguage (MRL)
DTO.gms sep Command
Get the separator character used before milliseconds
Intention
This command detects the separator character (typically '.' or ',') used immediately before the millisecond or fractional second part in a time string or a time format mask. It returns only the separator character itself.
It first checks the optional Format Mask. If a separator is found there before the millisecond component (e.g., 'ttt' or 'XXXX'), that separator is returned. If not found in the mask, it then checks the Time String itself, looking for the last separator that could indicate the start of milliseconds. If no specific separator is found in either, it defaults to ".".
This command contains the logic that was previously, and incorrectly, associated with the DTO.gtms command.
Syntax
DTO.gmssep|TimeString|[FormatMask]|[$$RES]
DTO.getmsseparator|...
Parameter Explanation
P1 - TimeString (Required)
The time string (or a variable, e.g., $$TIM) to examine for a millisecond separator.
Example: "14:30:45,123"
P2 - FormatMask (Optional)
The format mask string (or variable) to check first for the separator.
Example: "HH:MM:SS.ttt". If omitted, the command relies solely on analyzing the TimeString.
P3 - $$RES (Optional)
The variable (e.g., $$RES) where the detected separator character will be stored. If omitted, the result is placed on TOS.
Example
'**********************************************
' DTO.gmssep - Sample
'**********************************************
'
' --- Example 1: Detect "." from time string ---
$$TIM = "14:30:45.123"
DTO.gmssep|$$TIM||$$SEP
DBV.Separator 1: $$SEP ' Result: "."
'
' --- Example 2: Detect "," from format mask ---
$$TIM = "IgnoreThisString"
$$MSK = "HH:MM:SS,ttt"
DTO.gmssep|$$TIM|$$MSK|$$SEP
DBV.Separator 2: $$SEP ' Result: ","
'
' --- Example 3: No fractional part or separator (defaults to ".") ---
$$TIM = "10:20:30"
DTO.gmssep|$$TIM||$$SEP
DBV.Separator 3: $$SEP ' Result: "."
'
ENR.
Remarks
This command specifically returns the separator character ('.' or ',') used for fractional seconds.
To get the main time separator (like ':'), use DTO.GetTimeSeparator (gts).
To get the numeric value of the milliseconds, use the corrected DTO.GetTimeMilliseconds (gtms) command.
Limitations
- Detection relies on common patterns. Highly unusual formats might lead to the default "." being returned.
See also
• DTO.Get Time Milliseconds (gtms)
• DTO.Get Time Separator (gts)