1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

GOSUB

Discussion in 'Support' started by JohnQSmith, Jul 28, 2017.

  1. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    559
    Likes Received:
    7
    What am I doing wrong? Shouldn't it be echoing "07/28/17"?

    Code:
    [C:\temp]
    14:19:31 $ ver
    
    TCC  21.00.37 x64   Windows 7 [Version 6.1.7601]
    
    [C:\temp]
    14:20:02 $ type test.btm
    gosub testing "%_date"
    quit
    
    :testing [ %variable ]
    echo %variable
    return
    
    [C:\temp]
    14:20:04 $ test.btm
    gosub testing "07/28/17"
    echo
    ECHO is ON
    return
    quit
    
     
  2. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    559
    Likes Received:
    7
    Never mind... extra % symbol in the gosub parameter field.
     
  3. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    559
    Likes Received:
    7
    New question. How do I get it to not display the quotes?
    Code:
    [C:\temp]
    14:38:26 $ type test.btm
    @echo off
    gosub testing "Friday, July 28, 2017"
    quit
    
    :testing [ variable ]
    echo %variable
    return
    
    [C:\temp]
    14:38:38 $ test.btm
    "Friday, July 28, 2017"
    

    Edit:

    I found that the following works. Is there another way without the extra function call?
    Code:
    @echo off
    gosub testing "Friday, July 28, 2017"
    quit
    
    :testing [ variable ]
    echo %@strip["""", %variable]
    return
    
     
    #3 JohnQSmith, Jul 28, 2017
    Last edited: Jul 28, 2017
  4. TimButterfield

    Joined:
    May 20, 2008
    Messages:
    414
    Likes Received:
    2
    There is also the @unquote function.
     
    ron likes this.
  5. MaartenG

    Joined:
    Aug 3, 2016
    Messages:
    355
    Likes Received:
    8
    Replace the double quotes with escaped backquotes, like this:


    Code:
    gosub testing ^`Friday, July 28, 2017^`
    
     
  6. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    559
    Likes Received:
    7
    Thanks, I had tried single quotes and backquotes, but not escaped.
     

Share This Page