Difference between revisions of "InStr"

From MultiCharts
Jump to navigation Jump to search
 
Line 3: Line 3:
 
The position of the string being located is indicated by the number of characters from the left side of the string being evaluated.  
 
The position of the string being located is indicated by the number of characters from the left side of the string being evaluated.  
 
   
 
   
==== Usage ====
+
== Usage ==
<syntaxhighlight>InStr(String1,String2)</syntaxhighlight>  
+
<syntaxhighlight>InStr(String1, String2)</syntaxhighlight>  
  
Where: [[String1]]  - a string to be evaluated
+
Where:  
 +
 
 +
:'''String1''' - a string to be evaluated.
 
              
 
              
[[String2]]  - a string to be located
+
:'''String2''' - a string expression to be located.
 
 
==== Notes ====
 
In case the search returns no results 0 is returned
 
 
 
In case if the sought word occurs more than once, the first position will be returned
 
  
Search is case sensetive
+
== Notes ==
 +
* In case the search returns no results, a 0 is returned.
 +
* In case if the sought word occurs more than once, the first position will be returned.
 +
* The search performed by InStr is case sensitive.
 
   
 
   
==== Example ====
+
== Examples ==
 
<syntaxhighlight>InStr("Friday is the expiration day", "Friday");</syntaxhighlight>
 
<syntaxhighlight>InStr("Friday is the expiration day", "Friday");</syntaxhighlight>
 
+
Will return a value of 1, indicating that the string "Friday" begins at position 1 of the String "Friday is the expiration day".
will return a value of 1, indicating that the string "Friday" begins at position 1 of the String "Friday is the expiration day"  
 
  
 
<syntaxhighlight>InStr("Friday is the expiration day", "Monday");</syntaxhighlight>
 
<syntaxhighlight>InStr("Friday is the expiration day", "Monday");</syntaxhighlight>
 
+
Will return a value of 0, indicating that the string "Monday" does not exist in the String "Friday is the expiration day".
will return a value of 0, indicating that the string "Monday" does not exist in the String "Friday is the expiration day"  
 
 
  
 
[[Category:Text Manipulation]]
 
[[Category:Text Manipulation]]

Latest revision as of 07:41, 9 February 2012

Returns the position of a specified string expression inside another specified string expression.

The position of the string being located is indicated by the number of characters from the left side of the string being evaluated.

Usage

InStr(String1, String2)

Where:

String1 - a string to be evaluated.
String2 - a string expression to be located.

Notes

  • In case the search returns no results, a 0 is returned.
  • In case if the sought word occurs more than once, the first position will be returned.
  • The search performed by InStr is case sensitive.

Examples

InStr("Friday is the expiration day", "Friday");

Will return a value of 1, indicating that the string "Friday" begins at position 1 of the String "Friday is the expiration day".

InStr("Friday is the expiration day", "Monday");

Will return a value of 0, indicating that the string "Monday" does not exist in the String "Friday is the expiration day".