GDL Text Addon: String detection

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-31
03:17 PM
- last edited on
‎2022-09-26
10:45 PM
by
Daniel Kassai
‎2020-08-31
03:17 PM
I know, we had this issue some years ago:
If I use TEXT Addon and import multi line text file, the GDL Interpreter uses to define the vartype of the text the same kind as the 1st character in one line.
So if the line starts with 0.012, the rest will interpreted as number. This causes that text operations with STW etc. will give an error message, because a string was expected.
The solution for this issue was to put a # in front of every line, so the following will be detected as text.
If I get the textfile from an interactive schedule, I do not want to have column with # in front.
Using VARTYPE to detect the vartype, gives an error too:
IF VARTYPE(myText) = 2 THEN myText = myText + str_TEXT_trenner ! STRING
IF VARTYPE(myText) = 1 THEN myText = STR(myText, 4, 3) + str_TEXT_trenner ! NUMBER
Any new ideas for this?
If I use TEXT Addon and import multi line text file, the GDL Interpreter uses to define the vartype of the text the same kind as the 1st character in one line.
So if the line starts with 0.012, the rest will interpreted as number. This causes that text operations with STW etc. will give an error message, because a string was expected.
The solution for this issue was to put a # in front of every line, so the following will be detected as text.
If I get the textfile from an interactive schedule, I do not want to have column with # in front.
Using VARTYPE to detect the vartype, gives an error too:
IF VARTYPE(myText) = 2 THEN myText = myText + str_TEXT_trenner ! STRING
IF VARTYPE(myText) = 1 THEN myText = STR(myText, 4, 3) + str_TEXT_trenner ! NUMBER
Any new ideas for this?
Jochen Suehlo . AC12-28 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
GDL object creation: b-prisma.de
Labels:
- Labels:
-
Library (GDL)
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-31 03:57 PM
‎2020-08-31
03:57 PM
I had the same issue with ZIP codes. The following code worked fine for me (data mode):
_prjChannel = open("DATA", fileSettings, "SEPARATOR='\t', MODE=RO, LIBRARY") _nVal = input(_prjChannel, "thirdPLZ", 1, thirdPLZ) ! Postleitzahl abfangen und in Zeichenkette umwandeln if vartype(thirdPLZ) = 1 then thirdPLZ = str("%^4.0", thirdPLZ)
AC27 CHE - macOS Ventura M1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-31 06:42 PM
‎2020-08-31
06:42 PM
Thank, that works great without error

Jochen Suehlo . AC12-28 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
GDL object creation: b-prisma.de