Difference between revisions of "LIKE()"

From Lianjapedia
Jump to: navigation, search
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to compare two strings for similarities
 
Function to compare two strings for similarities
 
  
 
==Syntax==
 
==Syntax==
 
LIKE(<expC1>, <expC2>)
 
LIKE(<expC1>, <expC2>)
 
  
 
==See Also==
 
==See Also==
 
[[SOUNDEX()]], [[STRTRAN()]]
 
[[SOUNDEX()]], [[STRTRAN()]]
 
  
 
==Description==
 
==Description==
The LIKE() function is used to compare two character strings for matching qualities.  The <expC1> specifies the matching pattern to look for.  The <expC2> specifies the string in which to look.  The <expC1> accepts "wildcard" characters with which to construct the pattern.  Wildcard characters may represent upper case or lower case characters, but specific characters are case sensitive.  The Recital/4GL supports the following wildcard characters:
+
The LIKE() function is used to compare two character strings for matching qualities.  The <expC1> specifies the matching pattern to look for.  The <expC2> specifies the string in which to look.  The <expC1> accepts "wildcard" characters with which to construct the pattern.  Wildcard characters may represent upper case or lower case characters, but specific characters are case sensitive.  The following wildcard characters are supported:
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
 
!Characters||Description
 
!Characters||Description
 
|-
 
|-
Line 25: Line 21:
 
|-
 
|-
 
|}
 
|}
 
  
 
If the LIKE() function is used in SQL statements, the following wildcard characters are available:
 
If the LIKE() function is used in SQL statements, the following wildcard characters are available:
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
 
!Characters||Description
 
!Characters||Description
 
|-
 
|-
Line 38: Line 32:
 
|-
 
|-
 
|}
 
|}
 
  
 
The LIKE() function returns .T. if a matching pattern is found, or .F. otherwise.
 
The LIKE() function returns .T. if a matching pattern is found, or .F. otherwise.
 
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
?like("*Recital*", "This is Recital")
+
?like("*Lianja*", "This is Lianja")
 
.T.
 
.T.
 
</code>
 
</code>
  
  
==Products==
+
Recital Server, Recital
+
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:String Data]]
 
 
[[Category:String Data Functions]]
 
[[Category:String Data Functions]]
 +
[[Category:Search Functions]]

Latest revision as of 06:39, 4 February 2013

Purpose

Function to compare two strings for similarities

Syntax

LIKE(<expC1>, <expC2>)

See Also

SOUNDEX(), STRTRAN()

Description

The LIKE() function is used to compare two character strings for matching qualities. The <expC1> specifies the matching pattern to look for. The <expC2> specifies the string in which to look. The <expC1> accepts "wildcard" characters with which to construct the pattern. Wildcard characters may represent upper case or lower case characters, but specific characters are case sensitive. The following wildcard characters are supported:

Characters Description
? Matches any one character
% Synonymous with ?
* Matches zero or more characters

If the LIKE() function is used in SQL statements, the following wildcard characters are available:

Characters Description
_ Matches any one character
% Matches zero or more characters

The LIKE() function returns .T. if a matching pattern is found, or .F. otherwise.

Example

?like("*Lianja*", "This is Lianja")
.T.