Shop OBEX P1 Docs P2 Docs Learn Events
Two strings in one — Parallax Forums

Two strings in one

Bstamp_gpsBstamp_gps Posts: 9
edited 2007-07-12 17:14 in Propeller 1
Hi all,

How can we add two (or more) strings in one?

I have:

DAT Header byte "ID,8888,",0

And

match_inp(string("$GPRMC,"), 1)
RMC_Datas := match_inp(string("*"), 0)
Which contain: 082441.66,A,0056.43297,N,00054.96627,W,0.0,317.0,120707,0.0,W

I need:

ModStr := Header,RMC_Datas
ID,8888, 082441.66,A,0056.43297,N,00054.96627,W,0.0,317.0,120707,0.0,W

Thanks.

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-07-12 10:52
    DAT
    HEader byte "ID...."
    followup byte 0[noparse][[/noparse]100] ' or whatever seems safe


    Then do:
    BYTEMOVE (followup, RMC_DATES, 100)

    You can also try to find the correct length of the string by e.g. looking for the zero delimiter.
    BTW: What does match_inp do? It has to allocate some space for the string....
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-12 12:12
    Some quick code before I have to run, not tested but have used before:

    byte myStr[noparse][[/noparse]100]
    ...
    
    bytefill(@myStr,0,100)  ' fill with zeros
    bytemove(@myStr, @str1, strSize(str1))  ' move bytes to myStr at start pos
    
    bytemove(@myStr + strsize(myStr), @str2, strSize(str2)) ' Add str 2 starting at current length of myStr
    
    ...
    
    
    

    -Martin


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • Bstamp_gpsBstamp_gps Posts: 9
    edited 2007-07-12 17:14
    Many thanks, Martin! that's work for me.

    Thanks deSilva for putting me on the right track as well


    roll.gif
Sign In or Register to comment.