Rocket U2 | UniVerse & UniData

 View Only
  • 1.  Assigning literal strings to variables

    Posted 03-27-2023 12:44

    What are all the valid ways to quote literal strings when assigning them to variables in unibasic on Unidata?



    ------------------------------
    Shawn Waldie
    enterprise application developer
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------


  • 2.  RE: Assigning literal strings to variables
    Best Answer

    Posted 03-27-2023 13:47

    I use double quotes, single quotes, and backslashes.

    "Hello"

    'Hello'

    \Hello\

    of course the functions DQUOTE and SQUOTE can be useful too.



    ------------------------------
    David Green
    Computer Programmer
    Rocket Forum Shared Account
    ------------------------------



  • 3.  RE: Assigning literal strings to variables

    Posted 03-27-2023 13:54

    Thank you, David.

    I knew there was at least one more way to do it.



    ------------------------------
    Shawn Waldie
    enterprise application developer
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------



  • 4.  RE: Assigning literal strings to variables

    Posted 03-28-2023 08:57

    Shawn,

    For consistency I never use a  '  but rather ".  

    COLOR = "BLUE"   ;* preferred method of the "

    COLOR = 'RED'    ;*  never used. 

    COLOR = \YELLOW\   ;* never use to assign a variable but preferred method to execute a TCL statement or an Operating system command. 

    STMT = \SELECT FILENAME WITH COLOR = "BLUE" \   ;* preferred method of the \    It's much easier to read and easy on the eyes. 



    ------------------------------
    Peter Gonzalez
    Programmer/Systems Analyst/EDI Developer
    Self Registered
    St. Louis MO US
    ------------------------------



  • 5.  RE: Assigning literal strings to variables

    Posted 03-28-2023 21:50

    Great suggestions...thank you, Peter.

    In the case that gave rise to my initial question, i have to use something other than a double quote since the string being defined will contain those.



    ------------------------------
    Shawn Waldie
    enterprise application developer
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------