Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

No conversion from string to numerical?

Laszlo Nagy
Community Admin
Community Admin
Hi guys,
Is it possible to convert a string variable to a numerical value in GDL?
I know it is possible to convert a numerical to a string, but what about the other way? I cannot seem to find any such command.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
7 REPLIES 7
Anonymous
Not applicable
laszlonagy wrote:
Hi guys,
Is it possible to convert a string variable to a numerical value in GDL?
I know it is possible to convert a numerical to a string, but what about the other way? I cannot seem to find any such command.
Hi Laszlo,

SPLIT function should do the trick.

string = "3 pieces 2x5 beam"
n = split (string, "%n pieces %nx%n %s", num, string1, size1, string2, size2, name)

print num, string1, size1, string2, size2, name

print vartype(num), vartype(string1), vartype(size1), vartype(string2), vartype(size2), vartype(name)
!!! 1 numeric, 2 string

Cheers,
Olivier
Anonymous
Not applicable
I would like to add, that if you call
SPLIT( "3.45", "%n", X)
it returns X=3.45!

Cheers,
Leo
Laszlo Nagy
Community Admin
Community Admin
Thanks guys,
I knew there must have been something.
I have not used this command for a very long time.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Anonymous
Not applicable
You are welcome, new horrible moderator !

What a pity I couldn't recommend you a function for converting strings (for example) to your daytime and stamina

Good luck,
Leo
Djordje
Virtuoso
Leo wrote:
You are welcome, new horrible moderator !
Give the guy a chance ... he is nowhere near horrible! 😉
Djordje



ArchiCAD since 4.55 ... 1995
HP Omen
Anonymous
Not applicable
Djordje wrote:
Give the guy a chance ... he is nowhere near horrible! 😉
Yes Sir, THE MOST HORRIBLE MODERATOR OF THE FORUM WHO WE'VE EVER SEEN AND FOREVER ! We'll give him a chance
Laszlo Nagy
Community Admin
Community Admin
Thanks.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28