FANDOM


: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.

LocationEdit

In the catalog

nspire

  • Catalog
  • 2
  • String
  • Position in String

ExampleEdit

: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.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.