SB can't escape quotes in strings correctly.

Small Visual Basic 411 Reputation points
2022-09-19T01:45:58.98+00:00

In the online version, this line will not compile:
TextWindow.WriteLine("My name is ""Adam"".")
And in SB 1.2, it will compile, but the resulting string will be:

My name is ""Adam"".

not:

My name is "Adam".

And I can't find SB 1.3 to check how it treats this, and I hope it was fixed.
Anyway, I fixed this bug in Small Visual Basic.

Small BASIC
Small BASIC
A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
277 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dillon Silzer 54,746 Reputation points
    2022-09-19T02:08:59.22+00:00

    Hi @Small Visual Basic

    You could use the following code to get My Name is "Adam"

    ' A new Program!  
    DoubleQuotes = Text.GetCharacter(34)  
      
    TextWindow.WriteLine("What is your name?")  
    name = TextWindow.Read()  
    TextWindow.WriteLine("My name is" + DoubleQuotes + "Adam" + DoubleQuotes)  
    

    Preview:

    242372-image.png

    Run:

    242260-image.png

    Found suggestion of Text.GetCharacter(34) from https://social.msdn.microsoft.com/Forums/en-US/2a91d280-7d62-43cb-8b41-4e7bb809ec95/using-double-quotes-in-strings?forum=smallbasic

    ------------------------------

    If this is helpful please accept answer.