Shop OBEX P1 Docs P2 Docs Learn Events
String Manipulation — Parallax Forums

String Manipulation

JimGJimG Posts: 84
edited 2006-10-16 22:01 in BASIC Stamp
Are there commands that will allow one to extract, count, modify strings?· I am unable to find any and wonder if I am just missing them.

EX:

Extract the 7 character from the string "Mary had a little lamb."
Produces the letter a

Thanks,

Jim

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-16 20:39
    The Stamp does not have string manipulation commands. You can certainly write them yourself using arrays of bytes. The main issue is that the Stamp has very limited variable storage (about 26 bytes). Some of the Stamp models (p/pe/px) have separate scratchpad RAM using GET/PUT statements and some limited string manipulation would make sense there. The SERIN/SEROUT statements can read/write strings from successive byte variables or a byte array and the SERIN statement can input directly into this scratchpad RAM. Look at the description of byte arrays in the Basic Stamp Manual.
  • JimGJimG Posts: 84
    edited 2006-10-16 20:43
    Mike,

    Thanks. I am learning more an more about the benefits and restrictions of embedded processors with storage being one of the issues. I saw the byte arrays and thought that might be my only solution.

    Jim
  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-16 21:00
    Seriously consider using the Propeller instead if you have any significant amount of computation or data storage and manipulation needed. SPIN only has limited built-in string manipulation, but it's very easy to add "library" routines to do anything you want.
  • JimGJimG Posts: 84
    edited 2006-10-16 21:08
    Mike,

    I'll get there. I'm sure. My efforts, today, is to conquer the Stamp I have (actually I have a couple that came to me mystically) then move on the bigger and better as soon as I find some real use for them.

    I am pretty spoiled. I am a software engineer so am used to have lots of everything to play with. I am having to learn to code like back in my 1985 assembler days...this is actaully a good thing!

    If I want real horsepower I'll use a PC. I am jsut reviviing an electronics hobby that I had when I was a teen (that's a long time ago) and the Stamps looked like fun.

    One of the nice parts of the Stamps is this forum. I have yet to be unable to find an answer I was looking for here.

    Thanks,

    Jim
  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-16 21:33
    You can do a lot of controlling of all sorts of devices with the Stamps. Computationally, they're pretty minimal, but some impressive stuff has been done with them. The I/O statements (as you might expect) are pretty powerful. Tracey Allen has a website just chock-full of information on "higher math" with stamps and some really sophisticated control stuff at <www.emesystems.com>.
  • JimGJimG Posts: 84
    edited 2006-10-16 22:01
    Mike,

    Thanks for the lead, I'll check out Tracey's stuff. I can see right now that I am going to be investigating EEPROM expansion boards if I do anything very serious with the Stamps. Right now I have Boe Bot chasing my dogs arouund and that is kind of the extent on my experimetning except for talking to the LCD's, which I happen to have a few of as well.

    You're a good guy, thanks fo rthe help.

    Jim
Sign In or Register to comment.