? Variable contains reading? (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Variable contains reading?

  • #1 ✎ 25 Ertas Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Is there a way to read a variable and say it contains ... Example If my variable contains “72901003” then i want it to know if it contains number 3, is there a code for that? Posted
  • #2 ✎ 13 hanzo The function STRSRCH in the following code yields TRUE if the first string argument includes the second string argument and FALSE if not. DEF STRSRCH(A$,B$) VAR LA=LEN(A$),LB=LEN(B$) VAR I IF LB>LA THEN RETURN FALSE FOR I=0 TO LA-LB IF MID$(A$,I,LB)==B$ THEN RETURN TRUE NEXT I RETURN FALSE END READ A$,B$ IF STRSRCH(A$,B$) THEN ?A$;:?" INCLUDES ";:?B$;:?"." ELSE ?A$;:?" DOESN'T INCLUDE ";:?B$;:?"." ENDIF DATA "7291003","03" Posted
  • #3 ✎ 990 Yttria Head Admin For very simple searches on strings, you might be able to use INSTR()
    >INSTR: Searches for the target character string in another character string >>Variable = INSTR( [Start position,] "Character string to search in", "Character string to search" )
    INSTR(S$, "...") > -1 or more hacklike with numbers INSTR(STR$(72901003), "3") > -1
    Posted
  • #4 ✎ 25 Ertas Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Thanks, i have figured it out now i can continue to my project Posted