Max int length for ToString$

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Max int length for ToString$

Post by GTF »

Is there a maximum length that will be converted? If my number is greater than 4 digits, it gets truncated to the first 4.
eg. 12345 converts to 1234

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Max int length for ToString$

Post by kersing »

The obvious question first, what is the length of your string?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Max int length for ToString$

Post by GTF »

I created a standard string variable (length 20). I am sending over USB serial.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Max int length for ToString$

Post by medelec35 »

Hi Grant,
I have created a ULong assigned it with 1234567890 and no problems sending via UART USB:
Ulong to string via uart to USB converter.png
(178.37 KiB) Downloaded 3386 times
Or in your case Serial USB:
Ulong to string via Serial USB.png
(213.24 KiB) Downloaded 3386 times
Martin
Martin

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Max int length for ToString$

Post by GTF »

Actually, I think it was a string length issue. I forgot that the variable was concatenated with other strings. The sum length of the strings had grown too long for the holding string[30].

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Max int length for ToString$

Post by medelec35 »

Did you want to post the flowchart you are having issues with?
Martin

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Max int length for ToString$

Post by GTF »

Turns out it is not a string length issue. It appears to be related to the concatenation itself. This doesn't work(string1[40]), but sending the converted 12345 alone works.
Attachments
string.png
(112.4 KiB) Downloaded 798 times
string1.png
(6.18 KiB) Downloaded 3376 times
Last edited by GTF on Wed Apr 06, 2016 2:47 am, edited 1 time in total.

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: Max int length for ToString$

Post by GTF »

This works fine
Attachments
string3.png
(6.89 KiB) Downloaded 3376 times
string4.png
(7.57 KiB) Downloaded 3376 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Max int length for ToString$

Post by LeighM »

Hi

You are right, it is string concatenation that causes issues when more than two are concatenated.

This will cause problems (due to an internal bug with the use of a temporary string) ...

Code: Select all

str = str1 + str2 + str3
Instead, do this ...

Code: Select all

str = str1
str = str + str2
str = str + str3
Hope that helps,
Leigh

Post Reply