|
|
CONVERT DATA (CD) |
|
Standard Verb Miscellaneous Data Manipulation |
Converts data according to the given style.
The result of the conversion is always written to a new noun. The contents of the original noun are never changed.
CONVERT DATA in noun DATA convert style CONVERT STYLE return to the noun RESULT
DATA is an expression, or a noun containing the data that has to be converted.
CONVERT STYLE is a number or a noun containing the style number of the conversion.
RESULT will contain the converted data.
The conversion style determines the type of conversion that will be performed.
| 1 | Uppercase | Converts an expression to an uppercase expression. |
| 2 | Lowercase | Converts an expression to a lowercase expression. |
| 3 | Reverse | Reverses the order of the characters in an expression. |
| 4 | Trim left | Trims the leading whitespace characters from an expression. Removes newline, space and tab characters. |
| 5 | Trim right | Trims the trailing whitespace characters from an expression. Removes newline, space and tab characters. |
| 6 | Convert to number | Converts an expression whenever possible to a number. If the conversion is not possible, the returned value will be a zero (0). |
If the data is binary, the verb will do nothing and the resulting noun will be unchanged.
The square brackets [ ] are not a part of the converted output but only used in these examples to illustrate the formatting.
| Expression |
Convert Style |
Result |
abcdef ABCDEF ABCDEF [ Hello world] [Hello world ] |
|
ABCDEF abcdef FEDCBA [Hello world] [Hello world] |
| 801 | YYYYMMDD to Julian Date |
Converts a string of date of
the format YYYYMMDD to the Julian Date. The Julian Date represents a
continuous count of time in days since noon of January 1, 4713 B.C.
The Julian date algorithms have been taken from the web site: http://webexhibits.org/calendars/calendar-christian.html Please note that Logical does not assume any responsability to the accuracy of the algorithm. Read the notice below if you want to convert BC dates. Example: February 16, 2006 (20060215) has a Julian Date of 2,453,783. |
| 802 | Julian Date to YYYYMMDD | Converts a Julian date to a string of date
of the format YYYYMMDD (Gregorian date)
Example: The Julian date of 2,453,783 has a Gregorian Date of February 16, 2006 (20060215). Gregorian date is the system we normally use. |

| 803 | YYYYMMDD to Day of the Week |
Converts a string of date of
the format YYYYMMDD to the day of the week. The result is a number that
represents the day of the week where:
0 = Sunday We do not take responsibility for the accuracy of the conversion. Use at your own risk. Be especially cautious of dates earlier than the 19th century. Example: December 7, 1941 (19411207) was a Sunday. |

| 901 | String to ASCII number string |
Converts a string to a string
of ASCII numbers that represent the characters of the string. The ASCII
characters code is used.
For example the string "Logical" converts to "76-111-103-105-99-97-108". |
| 902 | ASCII number string | Converts a string to a string
of ASCII numbers separated by a minus sign (-) to a string of characters.
The ASCII characters code is used.
For example, the string "80-114-97-103-109-97-32-53" converts to "Pragma 5". |
In the Test program (MENU TEST) that is part of the PRAGMA 6 tutorial you can
find an example that illustrates the use of the verb CONVERT DATA.
The name of the test form is FORM TEST DATA CONVERT.
Another example of the conversion of Gregorian date to Julian Date is in the form FORM TEST TIME AND REGISTRY.