|
of_setkeyvalue
|
|
Full name
|
pfc_n_cst_string.of_setkeyvalue
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_setkeyvalue(ref string,string,string,string)
|
Name
|
Datatype
|
li_equal
|
integer
|
li_found
|
integer
|
li_keyword
|
integer
|
li_null
|
integer
|
li_separator
|
integer
|
ls_temp
|
string
|
public function integer of_setkeyvalue (ref string as_source, string as_keyword, string as_keyvalue, string as_separator);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_SetKeyValue
//
// Access: public
//
// Arguments:
// as_source The string to have the set performed on. Passed by reference.
// Format: keyword = value; ...
// as_keyword The keyword to set a value for.
// as_keyvalue The new value for the specified keyword.
// as_separator The separator character used in the source string.
//
// Returns: integer
// 1 Successful operation.
// -1 The specified keywork did not exist in the source string.
// If any argument's value is NULL, function returns NULL.
//
// Description: Sets the value portion of a keyword=value pair from a string
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
integer li_found=-1
integer li_keyword, &
li_separator, &
li_equal
string ls_temp
//Check paramemeters
If IsNull(as_source) or IsNull(as_keyword) or IsNull(as_keyvalue) or IsNull(as_separator) Then
integer li_null
SetNull (li_null)
Return li_null
End If
do
li_keyword = Pos (Lower(as_source), Lower(as_keyword), li_keyword + 1)
if li_keyword > 0 then
ls_temp = LeftTrim (Right (as_source, Len(as_source) - (li_keyword + Len(as_keyword) - 1)))
if Left (ls_temp, 1) = "=" then
li_equal = Pos (as_source, "=", li_keyword + 1)
li_separator = Pos (as_source, as_separator, li_equal + 1)
if li_separator > 0 then
as_source = Left(as_source, li_equal) + as_keyvalue + as_separator + Right(as_source, Len(as_source) - li_separator)
else
as_source = Left(as_source, li_equal) + as_keyvalue
end if
li_found = 1
end if
end if
loop while li_keyword > 0
return li_found
end function
Name
|
Owner
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.left |
systemfunctions
|
systemfunctions.lefttrim |
systemfunctions
|
systemfunctions.len |
systemfunctions
|
systemfunctions.lower |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
systemfunctions.right |
systemfunctions
|
systemfunctions.setnull |
systemfunctions
|