TI-BASIC Wiki
Advertisement
:inString(string,substring)

This function determines if the substring appears in the string. It returns the location of the first instance of substring in string. If substring is not in string, it returns 0.

:inString(string,substring,start)

start is an int after which the command should check. If substring is in string before the indicated location, this will ignore that instance.

Location[]

In the catalog

nspire

  • Catalog
  • 2
  • String
  • Position in String

Example[]

:Prompt Str1,Str2
:0S
:0→N
:
:While inString(Str1,Str2,S)
:inString(Str1,Str2,S)+1→S
:N+1→N
:End
:
:Disp "Str2 IN Str1",N,"TIMES"

This prompts the user for two strings, then returns the number of times the second string appears in the first string.

Advertisement