We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

How to convert numbers to string values

tsturm
Newcomer
Can anyone out there tell me how they would convert a number value to a string value?

I need to change numbers into text so that I can combine text strings in the TEXT2 command.

What can be done?

for example...

I want to have the text from the file name "TYP B00 3D" read as "B12 3D"

I have set up a series of string commands to break the name into different parameters.

Thus there is
textparts=SPLIT(part_name, "%s %s%n %n%s", junk, cab, cabsize, drawernum, cabtyp)

junk= !TYP
cab= ! B
cabsize=00
drawernum=3
cabtyp= ! D
A=12

TEXT2 0, 0, cab+A+" "+drawernum+cabtyp

Problem is this express has syntax errors. I need to change the "A" and "drawernum" parameters into text values.

How can this be done?

TIA
Terrence Sturm, Architect
_______________
MBP OSX 10.15.4 Quad Core Intel i7 2.2hz
AC 17 build 5019
AC 22 build 7000
AC 23 build
AC 24 build 5000
4 REPLIES 4
Ralph Wessel
Mentor
tsturm wrote:
Problem is this express has syntax errors. I need to change the "A" and "drawernum" parameters into text values. How can this be done?
Take a look at the STR function. For example, if A has the value 123, the expression STR(A, 3, 0) changes it to the string "123".
Ralph Wessel BArch
Software Engineer Speckle Systems
tsturm
Newcomer
Is it true that the SPLIT command will change numbers written as string into numbers?

For example the expression of
stringtext=134.56
SPLIT(stringtext," %n", stringnumber)
Then I would get a number instead of text?

TIA
Terrence Sturm, Architect
_______________
MBP OSX 10.15.4 Quad Core Intel i7 2.2hz
AC 17 build 5019
AC 22 build 7000
AC 23 build
AC 24 build 5000
Ralph Wessel
Mentor
tsturm wrote:
Is it true that the SPLIT command will change numbers written as string into numbers?

For example the expression of
stringtext=134.56
SPLIT(stringtext," %n", stringnumber)
Then I would get a number instead of text?

TIA
Close - try something like this:
strVal = "123.45"
numVal = 0
howMany = split(strVal, "%n", numVal)
You will end up with the numeric equivalent of 'strVal' in 'numVal', and 'howMany' should be 1 to tell you that one value was extracted from the string.
Ralph Wessel BArch
Software Engineer Speckle Systems
tsturm
Newcomer
I think that I now have a better understanding of how to change numbers into text and back again.

Now if GS would just make a STRING command to simply toggle the stuff around I would not need to type out things such as
part_num=159684
part_name=STR(part_num, 7, 0)
to change numbers to text.

How about a command like STNT(number) to change numbers to text and STTN(string) to change text to numbers.

Perhaps.
Terrence Sturm, Architect
_______________
MBP OSX 10.15.4 Quad Core Intel i7 2.2hz
AC 17 build 5019
AC 22 build 7000
AC 23 build
AC 24 build 5000