// Function Name : f_arraytostring
// Argument Name : as_source[], Arg Type : String, Pass By : Value
// as_delimiter, Arg Type : String, Pass By : Value
// as_ref_string, Arg Type : String, Pass By : Reference
// Return Type : Long
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Description: Create a single string from an array of strings separated by
// the passed delimeter.
// Note: Function will not include on the single string any
// array entries which match an empty string.
//
// Arguments:
// as_source[] The array of string to be moved into a single string.
// as_Delimiter The delimeter string.
// as_ref_string The string to be filled with the array of strings,
// passed by reference.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
Long ll_Count
Long ll_ArrayUpBound
//Get the array size
ll_ArrayUpBound = UpperBound(as_source[])
//Check parameters
If IsNull(as_delimiter) or (Not ll_ArrayUpBound>0) Then
Return -1
End If
//Reset the Reference string
as_ref_string = ''
For ll_Count = 1 to ll_ArrayUpBound
//Do not include any entries that match an empty string
If as_source[ll_Count] <> '' Then
If Len(as_ref_string) = 0 Then
//Initialize string
as_ref_string = as_source[ll_Count]
Else
//Concatenate to string
as_ref_string = as_ref_string + as_delimiter + as_source[ll_Count]
End If
End If
Next
return 1
// Argument Name : as_source[], Arg Type : String, Pass By : Value
// as_delimiter, Arg Type : String, Pass By : Value
// as_ref_string, Arg Type : String, Pass By : Reference
// Return Type : Long
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Description: Create a single string from an array of strings separated by
// the passed delimeter.
// Note: Function will not include on the single string any
// array entries which match an empty string.
//
// Arguments:
// as_source[] The array of string to be moved into a single string.
// as_Delimiter The delimeter string.
// as_ref_string The string to be filled with the array of strings,
// passed by reference.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
Long ll_Count
Long ll_ArrayUpBound
//Get the array size
ll_ArrayUpBound = UpperBound(as_source[])
//Check parameters
If IsNull(as_delimiter) or (Not ll_ArrayUpBound>0) Then
Return -1
End If
//Reset the Reference string
as_ref_string = ''
For ll_Count = 1 to ll_ArrayUpBound
//Do not include any entries that match an empty string
If as_source[ll_Count] <> '' Then
If Len(as_ref_string) = 0 Then
//Initialize string
as_ref_string = as_source[ll_Count]
Else
//Concatenate to string
as_ref_string = as_ref_string + as_delimiter + as_source[ll_Count]
End If
End If
Next
return 1
0 comments:
Post a Comment