? I need coding help. (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
💀

I need coding help.

  • #1 ✎ 229 16bitcoder I need help for with my program. How could I check for strings and make this work? Like it checks if you say print and prints what is past it. My code: Linput"";K$ (Checks if K$ is print (Like PRINT" HI)) (Then it'll print only the hi) EXAMPLE WHEN RUN: >PRINT HI HI Posted Edited by 16bitcoder
  • #2 ✎ 174 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies I'm not sure what you're asking. But i think i get it a little. Youre saying that the user types "PRINT -some piece of text-" and you want only the piece of text to be displayed. alright, well you would need to do something like this LINPUT"";K$ P=INSTR$(K$,"PRINT"+CHR$(34)) 'That will literally search the inside of K$ for "PRINT"" and it returns the position of the word This would be helpful only if PRINT" were somewhere inside the string But if PRINT" is always at the beginning of K$, then you could just do this LINPUT"";K$ P=LEN(K$) K$=RIGHT$(K$,P-LEN("PRINT"+CHR$(34))) 'or you could just write P-6 instead of all that, doesnt really matter its all the same thats all i got Posted
  • #3 ✎ 229 16bitcoder
    I'm not sure what you're asking. But i think i get it a little. Youre saying that the user types "PRINT -some piece of text-" and you want only the piece of text to be displayed. alright, well you would need to do something like this LINPUT"";K$ P=INSTR$(K$,"PRINT"+CHR$(34)) 'That will literally search the inside of K$ for "PRINT"" and it returns the position of the word This would be helpful only if PRINT" were somewhere inside the string But if PRINT" is always at the beginning of K$, then you could just do this LINPUT"";K$ P=LEN(K$) K$=RIGHT$(K$,P-LEN("PRINT"+CHR$(34))) 'or you could just write P-6 instead of all that, doesnt really matter its all the same thats all i got
    Thanks!
    Posted