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
Max int length for ToString$
Moderator: Benj
-
- 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$
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
― C.S. Lewis
-
- 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$
I created a standard string variable (length 20). I am sending over USB serial.
-
- 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$
Hi Grant,
I have created a ULong assigned it with 1234567890 and no problems sending via UART USB: Or in your case Serial USB: Martin
I have created a ULong assigned it with 1234567890 and no problems sending via UART USB: Or in your case Serial USB: Martin
Martin
-
- 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$
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].
-
- 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$
Did you want to post the flowchart you are having issues with?
Martin
-
- 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$
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.
-
- 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$
This works fine
- Attachments
-
- string3.png
- (6.89 KiB) Downloaded 3376 times
-
- string4.png
- (7.57 KiB) Downloaded 3376 times
- 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$
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) ...
Instead, do this ...
Hope that helps,
Leigh
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
Code: Select all
str = str1
str = str + str2
str = str + str3
Leigh