Difference between revisions of "STRPOS()"

From Lianjapedia
Jump to: navigation, search
m (Text replace - "Recital" to "Lianja")
(Example)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to search for a substring
 
Function to search for a substring
 
  
 
==Syntax==
 
==Syntax==
 
STRPOS(<expC1>, <expC2> [, <expN>])
 
STRPOS(<expC1>, <expC2> [, <expN>])
 
  
 
==See Also==
 
==See Also==
 
[[AT()]], [[ATNEXT()]], [[INLIST()]], [[LEFT()]], [[OCCURS()]], [[RAT()]], [[RIGHT()]], [[SET STRESCAPE]], [[STR()]], [[STREXTRACT()]], [[STRTRAN()]], [[STUFF()]], [[SUBSTR()]]
 
[[AT()]], [[ATNEXT()]], [[INLIST()]], [[LEFT()]], [[OCCURS()]], [[RAT()]], [[RIGHT()]], [[SET STRESCAPE]], [[STR()]], [[STREXTRACT()]], [[STRTRAN()]], [[STUFF()]], [[SUBSTR()]]
 
  
 
==Description==
 
==Description==
 
STRPOS() is the substring search function.  It returns a number signifying the starting position of <expC2> in <expC1>.  If the substring is not contained within <expC2> or <memofield>, then the function returns the value 0.  The leftmost character of a string is in character position 1.  The optional numeric expression <expN> is used to specify an offset position at which to start the search (starting from 1).  The return value is based on the start of <expC1> regardless of the offset.  The STRPOS() function is particularly useful in conjunction with the LEFT() or SUBSTR() functions for locating starting points for extracting text from a string.
 
STRPOS() is the substring search function.  It returns a number signifying the starting position of <expC2> in <expC1>.  If the substring is not contained within <expC2> or <memofield>, then the function returns the value 0.  The leftmost character of a string is in character position 1.  The optional numeric expression <expN> is used to specify an offset position at which to start the search (starting from 1).  The return value is based on the start of <expC1> regardless of the offset.  The STRPOS() function is particularly useful in conjunction with the LEFT() or SUBSTR() functions for locating starting points for extracting text from a string.
 
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
? at("is", "Lianja is good")  
+
? strpos("Lianja is good","is")  
         9
+
         8
cString1 = "is"
+
cString1 = "Lianja is good"
cString2 = "Lianja is good"  
+
cString2 = "is"  
? at(cString1, cString2)
+
? strpos(cString1, cString2)
         9
+
         8
 
</code>
 
</code>
 
  
 
==Products==
 
==Products==
Line 30: Line 25:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:String Data]]
 
 
[[Category:String Data Functions]]
 
[[Category:String Data Functions]]

Latest revision as of 03:39, 1 July 2019

Purpose

Function to search for a substring

Syntax

STRPOS(<expC1>, <expC2> [, <expN>])

See Also

AT(), ATNEXT(), INLIST(), LEFT(), OCCURS(), RAT(), RIGHT(), SET STRESCAPE, STR(), STREXTRACT(), STRTRAN(), STUFF(), SUBSTR()

Description

STRPOS() is the substring search function. It returns a number signifying the starting position of <expC2> in <expC1>. If the substring is not contained within <expC2> or <memofield>, then the function returns the value 0. The leftmost character of a string is in character position 1. The optional numeric expression <expN> is used to specify an offset position at which to start the search (starting from 1). The return value is based on the start of <expC1> regardless of the offset. The STRPOS() function is particularly useful in conjunction with the LEFT() or SUBSTR() functions for locating starting points for extracting text from a string.

Example

? strpos("Lianja is good","is") 
         8
cString1 = "Lianja is good"
cString2 = "is" 
? strpos(cString1, cString2)
         8

Products

Lianja Server, Lianja