Class StringIndexOf

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class StringIndexOf
    extends TypedAtomicActor
    Output the index of a searchFor string contained in a given inText. The search begins at the index given by startIndex and ends at either the end or the beginning of the string, depending on whether searchForwards is true or false, respectively. If the string is not found, then the output is -1. If the string is found, then the output is the index of the start of the string, where index 0 refers to the first character in the string.
    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    Rakesh Reddy, Philip Baldwin, Edward A. Lee
    Pt.AcceptedRating:
    Green (eal)
    Pt.ProposedRating:
    Green (pjb2e)
    • Field Detail

      • ignoreCase

        public Parameter ignoreCase
        The parameter to state whether to ignore case. This is a boolean that defaults to false.
      • inText

        public PortParameter inText
        Port and parameter specifying the string that will be searched. This has type string and defaults to the empty string.
      • output

        public TypedIOPort output
        Output producing the index of the searchFor string, if it is found, and -1 otherwise. This has type int.
      • searchFor

        public PortParameter searchFor
        Port and parameter specifying a string to find in the inText string. This has type string and defaults to an empty string.
      • searchForwards

        public Parameter searchForwards
        Boolean parameter indicating the direction in which to search. This is true to find the first occurrence and false to find the last. The default value is true.
      • startIndex

        public PortParameter startIndex
        Port and parameter that determines where to start the search. This has type int and defaults to 0.