Shop OBEX P1 Docs P2 Docs Learn Events
STRING directive question — Parallax Forums

STRING directive question

mynet43mynet43 Posts: 644
edited 2007-09-29 18:00 in Propeller 1
According to the manual, the syntax for the STRING directive is:

STRING (StringExpression) -- with a single argument.

The example given is: -- PrintStr(string("This is a test string."))

So far, so good. This all makes complete sense. This is what's in the manual.


However, I was reviewing the code in the SD read/write test routine and I noticed a variation on this syntax that uses 2 arguments.

An example is: term.str(string("Dir: ", 13)) -- i.e. two arguments, output a return after the string.

This is great, and it works! Now I'll use it that way.

OK, so does someone have a general explanation of the real calling sequence?

I.e.
Does it allow more than two arguments?
Must the second argument be the value of an output character?
Etc. etc.

Thanks for your help.

Jim

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-09-29 17:01
    You can have as many arguments as you want, so long as they are constants. You can think of the multiple arguments as being just one, with the commas serving as concatenation operators.

    -Phil
  • mynet43mynet43 Posts: 644
    edited 2007-09-29 17:08
    Thanks Phil!

    Makes sense. I assume this means you can mix strings and values in any order in the arguments.

    Like several lines of output in one string( ) declaration. I'll try it.

    By the way, is this documented somewhere?

    Thanks,

    Jim
  • Ken PetersonKen Peterson Posts: 806
    edited 2007-09-29 17:42
    If not, it would be a really nice thing to add to the Propeller manual. I didn't know this either. Seems many "undocumented" features keep springing up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    The more I know, the more I know I don't know.· Is this what they call Wisdom?
  • mynet43mynet43 Posts: 644
    edited 2007-09-29 18:00
    Hey!

    I tried this:

       term.str(string("That's the dir", 13, "Line1",13,"Line2",13,"Line3",13))
    
    



    And it worked great!

    Printed four lines! Cool!

    Jim
Sign In or Register to comment.