String manipulation

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

Moderators: Benj, Mods

Post Reply
Eric
Posts: 99
Joined: Tue Nov 06, 2007 11:04 pm
Been thanked: 1 time

String manipulation

Post by Eric »

Hello,

Is there a reason why this works:

S = ToString$(Seconds)
M = ToString$(Minutes)
H = ToString$(Hours)
Timestring = H + ":" + M

Result = 14:45

and this doesn't:

S = ToString$(Seconds)
M = ToString$(Minutes)
H = ToString$(Hours)
Timestring = H + ":" + M + ":" + S

Errormessage = one or more of the string manipulation lines are invalid.

S, M and H are dimensioned as [5]
Timestring is dimensioned as [20]

Is this a bug?

Best regards,

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times

Re: String manipulation

Post by Sean »

Hello Eric,

There is a limit to the number of string additions that can be carrier out on a single line of code.
Only two strings can be added together at any time, so Flowcode breaks the line up into a series of additions. This is limited to 4 terms on a single line.

The following line generates an error because there are 5 terms in it:
Timestring = H + ":" + M + ":" + S

It can be replaced with the following two lines:
Timestring = H + ":" + M + ":"
Timestring = Timestring + S

These two lines can be contained in a single Flowcode block.

Eric
Posts: 99
Joined: Tue Nov 06, 2007 11:04 pm
Been thanked: 1 time

Re: String manipulation

Post by Eric »

Thanks Sean.

This is clear now.
Maybe interesting to add this info into the string help topic ? :-)

Regards.

Post Reply