Page 1 of 1

String problem

Posted: Fri Dec 31, 2010 12:06 pm
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

Re: String problem

Posted: Mon Jan 03, 2011 9:19 am
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.

Re: String problem

Posted: Mon Jan 03, 2011 9:41 pm
by Taurus
Hello Steve

This is just what I needed. :P

Thanks

Re: String problem

Posted: Tue Jan 04, 2011 8:47 am
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

Re: String problem

Posted: Tue Jan 04, 2011 9:27 am
by Steve
Ooops - you are correct, Wolfgang.