Possible bug? Unable to enter a comma in response to INPUT - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: Possible bug? Unable to enter a comma in response to INPUT (/showthread.php?tid=555) |
Possible bug? Unable to enter a comma in response to INPUT - hanness - 06-15-2022 In QB64pe 0.8.2 take a look at this code: Code: (Select All) a$ = "This is a string, with a comma" Notice that the first line simply set a string and that the string contains a comma. The second line is asking for input from a user. Start typing in a string of characters, and somewhere along the line, try to type a comma. The comma will not be accepted. When it gets to the print statements, it prints the string of text that includes a comma, so clearly a comma is a valid character in a string. Since a comma is a valid character, an INPUT should allow a user to input a comma as part of the string. RE: Possible bug? Unable to enter a comma in response to INPUT - DSMan195276 - 06-15-2022 This behavior is correct, it has to do with how `Input` allows entering multiple variables at once (with their values separated by a comma). Because of that, when using `Input` with a string on its own you cannot include a comma in the value. You should use `Line Input` instead, which basically works exactly like you want - it reads an entire line of input text into a single string, with no limitations on commas or etc. being in it. There is a note about this behavior on the Wiki, it goes into a bit more detail: https://qb64phoenix.com/qb64wiki/index.php/INPUT RE: Possible bug? Unable to enter a comma in response to INPUT - hanness - 06-15-2022 Thanks, much appreciated RE: Possible bug? Unable to enter a comma in response to INPUT - bplus - 06-15-2022 Use Line Input when you want to allow commas. BTW Input allows multiple Input because comma! Code: (Select All) Input "Give me a number comma another "; a, b RE: Possible bug? Unable to enter a comma in response to INPUT - euklides - 06-17-2022 If commas are needed, use something like this: Locate 10, 1: b$ = "": Print "Your texte here, (with comma also) : "; Text: GoSub saiscar: If z$ <> Chr$(13) Then Print z$;: b$ = b$ + z$: GoTo Text Print: Print: Color 0, 7: Print b$: Color 7, 0 Sleep: End saiscar: z$ = InKey$: If z$ <> "" Then GoTo saiscar Sais1: z$ = InKey$: If z$ = "" Then GoTo Sais1 Return |