The inString() Command

We're glad you came by, but you might find what you're looking for elsewhere.

TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it.

Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope.

instring.png

Command Summary

Finds a search string in another string.

Command Syntax

inString(string, search-string,[)

Menu Location

  • Press 2nd MATH to enter the MATH popup menu.
  • Press D to enter the Strings submenu.
  • Press 6 to select inString(.

Calculator Compatibility

This command works on all calculators.

Token Size

3 bytes

The inString() command searches for one string inside another, starting from the beginning and going forward. If it finds the string, it returns the position where it finds it. If it doesn't find the string, it returns 0. If the string is there multiple times, it will only find the first one.

Optionally, you can also give inString() a starting position. In that case, it won't find any occurrences of the strings earlier than that position.

:inString("Chop shops stock chops.","hops")
           7
:inString("Chop shops stock chops.","hops",8)
           20
:inString("Chop shops stock chops.","stocks")
           0

Related Commands

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.