ArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2014-03-30T17:24:12+02:00 https://brainmodular.org/forums/app.php/feed/topic/4332 2014-03-30T17:24:12+02:00 2014-03-30T17:24:12+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29245#p29245 <![CDATA[strtoint() and sysex]]>

CODE:

      for l&#58;=0 to Length&#40;string1&#41;      do begin        c &#58;=  string1&#91;l&#93;;        lcd&#91;0&#93;&#91;l&#93; &#58;= ord&#40; c &#41;;
Switching 'c' back to type char and and accessing the string as an array worked.

Statistics: Posted by ceasless — 30 Mar 2014, 17:24


]]>
2014-03-30T16:43:28+02:00 2014-03-30T16:43:28+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29244#p29244 <![CDATA[strtoint() and sysex]]>

CODE:

      for l&#58;=0 to Length&#40;string1&#41;      do begin        c &#58;=  copy&#40;string1, l, 1&#41;;         k &#58;= ord&#40; c &#41;;
The above code throws an 'Invalid cast' compile time error.

1) k is defined as an integer as in the first example.
2) c was first a char, but the StrGet function seems not to be defined so I switched c to a string and used copy with a length of 1.

Statistics: Posted by ceasless — 30 Mar 2014, 16:43


]]>
2014-03-26T13:14:07+02:00 2014-03-26T13:14:07+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29221#p29221 <![CDATA[strtoint() and sysex]]> Statistics: Posted by ceasless — 26 Mar 2014, 12:14


]]>
2014-03-25T22:49:05+02:00 2014-03-25T22:49:05+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29219#p29219 <![CDATA[strtoint() and sysex]]>

CODE:

var k&#58; integer;begin k &#58;= ord&#40;'s'&#41;; itrace&#40;k&#41;;end;
this should do the trick?

Statistics: Posted by senso — 25 Mar 2014, 21:49


]]>
2014-03-25T20:17:45+02:00 2014-03-25T20:17:45+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29215#p29215 <![CDATA[strtoint() and sysex]]>

CODE:

        k &#58;= strtoint&#40;'s'&#41;;        writeln&#40;'s is '+inttostr&#40; k &#41;&#41;;
That results in an error: Error : ''s'' is not a valid integer value

How can I get back the ASCII integer value of 's' ?

sorry, this got posted to general discussion but it should be in patching questions.

Statistics: Posted by ceasless — 25 Mar 2014, 19:17


]]>
BrainModular BrainModular Users Forum 2014-03-30T17:24:12+02:00 https://brainmodular.org/forums/app.php/feed/topic/4332 2014-03-30T17:24:12+02:00 2014-03-30T17:24:12+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29245#p29245 <![CDATA[strtoint() and sysex]]>

CODE:

      for l&#58;=0 to Length&#40;string1&#41;      do begin        c &#58;=  string1&#91;l&#93;;        lcd&#91;0&#93;&#91;l&#93; &#58;= ord&#40; c &#41;;
Switching 'c' back to type char and and accessing the string as an array worked.

Statistics: Posted by ceasless — 30 Mar 2014, 17:24


]]>
2014-03-30T16:43:28+02:00 2014-03-30T16:43:28+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29244#p29244 <![CDATA[strtoint() and sysex]]>

CODE:

      for l&#58;=0 to Length&#40;string1&#41;      do begin        c &#58;=  copy&#40;string1, l, 1&#41;;         k &#58;= ord&#40; c &#41;;
The above code throws an 'Invalid cast' compile time error.

1) k is defined as an integer as in the first example.
2) c was first a char, but the StrGet function seems not to be defined so I switched c to a string and used copy with a length of 1.

Statistics: Posted by ceasless — 30 Mar 2014, 16:43


]]>
2014-03-26T13:14:07+02:00 2014-03-26T13:14:07+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29221#p29221 <![CDATA[strtoint() and sysex]]> Statistics: Posted by ceasless — 26 Mar 2014, 12:14


]]>
2014-03-25T22:49:05+02:00 2014-03-25T22:49:05+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29219#p29219 <![CDATA[strtoint() and sysex]]>

CODE:

var k&#58; integer;begin k &#58;= ord&#40;'s'&#41;; itrace&#40;k&#41;;end;
this should do the trick?

Statistics: Posted by senso — 25 Mar 2014, 21:49


]]>
2014-03-25T20:17:45+02:00 2014-03-25T20:17:45+02:00 https://brainmodular.org/forums/viewtopic.php?t=4332&p=29215#p29215 <![CDATA[strtoint() and sysex]]>

CODE:

        k &#58;= strtoint&#40;'s'&#41;;        writeln&#40;'s is '+inttostr&#40; k &#41;&#41;;
That results in an error: Error : ''s'' is not a valid integer value

How can I get back the ASCII integer value of 's' ?

sorry, this got posted to general discussion but it should be in patching questions.

Statistics: Posted by ceasless — 25 Mar 2014, 19:17


]]>