String problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Taurus
Flowcode V4 User
Posts: 46
Joined: Tue Feb 23, 2010 3:58 pm
Has thanked: 3 times

String problem

Post by Taurus »

Hello

What I like to do is to send and receive a string with the RS232 port.
That’s no problem at all.

I would like to fill a string as in Basic A$= A$+ STR$(Value)
and read the value back in the string like Value=ASC(Mid$(A$,nr,1))

With other words,
how can I read a character like “A” back as a value 65 in a string.
or store the value 65 as “A” in the string

Please, can someone help me with this problem.

Thanks
Taurus

User avatar
Steve
Matrix Staff
Posts: 3421
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: String problem

Post by Steve »

In Flowcode, a string is essentially an array of bytes. So if you have a variable MyString = "ABC", then you can reference each character in the string is a calculation icon using square brackets, so MyString[0] is 'A' which equals 65 and MyString[2] is 'C' which equals 67.

If you had MyString[2] = 88 in a calculation icon, this would change the string MyString to "AXC".

I hope this helps.

Taurus
Flowcode V4 User
Posts: 46
Joined: Tue Feb 23, 2010 3:58 pm
Has thanked: 3 times

Re: String problem

Post by Taurus »

Hello Steve

This is just what I needed. :P

Thanks
Taurus

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: String problem

Post by saschech@gmx.de »

Hello all

If you had MyString[2] = 88 in a calculation icon, this would change the string MyString to "AXC".
correct is:
If you had MyString[1] = 88 in a calculation icon, this would change the string MyString to "AXC".

Regards Wolfgang

User avatar
Steve
Matrix Staff
Posts: 3421
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: String problem

Post by Steve »

Ooops - you are correct, Wolfgang.

Post Reply