|
of_countoccurrences
|
|
Full name
|
pfc_n_cst_string.of_countoccurrences
|
Access
|
public
|
Extend of
|
long
|
Return value
|
long
|
Prototype
|
public function long of_countoccurrences(string,string,boolean)
|
Name
|
Datatype
|
ll_Count
|
Long
|
ll_Len
|
Long
|
ll_null
|
long
|
ll_Pos
|
Long
|
public function long of_countoccurrences (string as_source, string as_target, boolean ab_ignorecase);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_CountOccurrences
//
// Access: public
//
// Arguments:
// as_Source The string in which to search.
// as_Target The string to search for.
// ab_IgnoreCase A boolean stating to ignore case sensitivity.
//
// Returns: long
// The number of occurrences of as_Target in as_source.
// If any argument's value is NULL, function returns NULL.
//
// Description: Count the occurrences of one string within another.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
Long ll_Count, ll_Pos, ll_Len
//Check for parameters
If IsNull(as_source) or IsNull(as_target) or IsNull(ab_ignorecase) Then
long ll_null
SetNull(ll_null)
Return ll_null
End If
//Should function ignore case?
If ab_ignorecase Then
as_source = Lower(as_source)
as_target = Lower(as_target)
End If
ll_Len = Len(as_Target)
ll_Count = 0
ll_Pos = Pos(as_source, as_Target)
Do While ll_Pos > 0
ll_Count ++
ll_Pos = Pos(as_source, as_Target, (ll_Pos + ll_Len))
Loop
Return ll_Count
end function
Name
|
Owner
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.len |
systemfunctions
|
systemfunctions.lower |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
systemfunctions.setnull |
systemfunctions
|