Concatenation addition to the Help File

Anonymous
2014-03-30
2014-03-31
  • Anonymous - 2014-03-30

    To the keepers of the new Help File:

    Under the heading of String operations, you might want to list the concatenation operator (plus) as an option.

    I ended up using string concatenation a fair amount in the Sine and Cosine routines I posted a little earlier. I wasn't sure if it was in the language, but I just went ahead and tried it, and there it was! And it works as expected.

    There really are lots of Easter eggs in GC Basic...

    Thomas Henry

     
  • Anobium

    Anobium - 2014-03-30

    Another learning. I wonder what the constraints are.

    I have added the following to the Help File. I will publish to the web next week.

    Concatenation
    
    Syntax: 
        stringvar = variable1 + variable2
    
    Command Availability:
        Available on all microcontrollers
    
    Explanation:
        The method join two variables into another variable. 
    
        This method does not change the existing strings, but returns a new string containing the text of the joined variables.
    
        Concatenation joins the elements of a specified values using the specified separator between each variable. 
    
    Example:
    
        timevariable = 999
    stringvar = "Time = " + timevariable ' Returns Time = 999 
    
     
    Last edit: Anobium 2014-03-30
  • Chuck Hellebuyck

    So the variables don't have to be string variables?
    How does that work?
    999 could be contained in a word or int which will use two bytes but 999 converted to a string requires three bytes. So is 999 converted to a string before being combined into a concatenated string variable?

     
  • Anobium

    Anobium - 2014-03-31

    Both variables need to be strings.

    StringVariable = str ( 999 ) + " works" ' works.

    StringVariable = str ( bytevariable ) + " works" ' works.

    StringVariable = stringvariable + " works" ' works.

    I will update help file to clarify.

     
    Last edit: Anobium 2014-03-31

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks