Description
Searches for the specified stringToFind in the calling String.
Timing Precision Mode
This page describes functionality in nanosecond timing precision mode.
Click here to see the documentation for this object in millisecond timing precision mode.
Method Signature
String.Find(
|
String stringToFind)
|
Arguments
stringToFind
|
|
Description:
|
The string or character to find in the calling String.
|
Return Value
Returns the index of the start of the specified stringToFind in the calling String. Returns -1 if stringToFind is not a sub-string of the calling String. If more than one instance of stringToFind occurs in the calling String, only the index of the first instance is returned.
Syntax
myVariable1 = myString1.Find(myString2);
|
This example demonstrates how to use the String.Find method
// Returns the index of the start of the specified string
Variable myVariable = "Feb 04 2020 10:20:30.400".Find("2020");
Report myVariable;
|
Output:
myVariable = 7.000000000
|
This example demonstrates the find method in the event the specified string appears more than once in the calling string.
// The Find method will only 'find' the first instance of the specified
// string regardless of reoccurrence.
Variable myVariable = "Feb 04 2020 10:20:30.400".Find("20");
Report myVariable;
|
Output:
myVariable = 7.000000000
|
See also
String Object
String.Find
Parsing Dates and Times
Parsing Arbitrary String Data
Parsing Arbitrary String Data
|