The inString() Command

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.