posw PowerHome formula function
Description
Finds one string within another string.
Syntax
posw ( string1, string2 {, start } )
Argument Description
string1 String. The string in which you want to find string2
string2 String. The string you want to find in string1
start (optional) Integer. A long indicating where the search will begin in string. The default is 1
Return value
Long. Returns a long whose value is the starting position of the first occurrence of string2 in string1 after the position specified in start. If string2 is not found in string1 or if start is not within string1, Posw returns 0.
Usage
The Posw function is case sensitive.
Examples
The following examples demonstrate typical syntax/ usage for this function.
Consider the following data which may have been returned by a ph_geturl() function (the data is simplified of course) and stored in LOCAL1 ...
 

<html>
<body>
   
<h4>Temperature</h4>
<b>78.5</b>
<h4>Humidity</h4>
<b>55.7</b>
<h4>Wind Speed</h4>
<b>7.5</b>
</body>
</html>

This function is often used in conjunction with other string extraction functions to locate the "sweet spot" where an extraction should take place. For instance ...
posw("[LOCAL1]","Humidity")
will find the location of the "H" in the word Humidity in the string, allowing, for instance, a follow-on ph_regexsnap() to extract the data between the next <b> and </b> tags starting at that posw() located starting position.

This function is also very useful in conjunction with the left() function to trim data off the end of a large string so that only the content of interest is being used to avoid "greedy" searches from finding unexpected data.