Shop OBEX P1 Docs P2 Docs Learn Events
How to create a string? — Parallax Forums

How to create a string?

CannibalRoboticsCannibalRobotics Posts: 535
edited 2010-02-10 01:56 in Propeller 1
I have a sequence of ASCII coming down a serial pipe into FullDuplexSerial.
I need to gather up the charactors and turn them into a string.
What's the best way, or can some one reference an obex entry with a good example?

Thanks in advance
Jim-


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2010-02-09 22:09
    don't know an obex-object that shows the storing part

    you define an array of bytes with a length that can store your longest string

    then you can use the method RxStr to receive the string.

    the bytearray is accessed through the variable-ADRESS by using the adress-operator "@"

    best regards

    Stefan
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-09 22:19
    A string is simply a byte array of characters terminated by a null ($00). So read the characters into the array as you increment the index and after you increment the index simply store a null at the current location without incrementing. As stefan mentioned you then pass the address of the array using "@" rather than the contents of one of the elements.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • KyeKye Posts: 2,200
    edited 2010-02-09 23:02
    Find the string library·engine in the obex by Kwabena W. Agyeman.

    It does everything you need.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2010-02-10 01:56
    Thanks all!

    Jim-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent!
    Send $1 to CannibalRobotics.com.
Sign In or Register to comment.