PowerBuilder Function Array To String gf_arraytostring
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : gf_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 |
Good Luck!
Subscribe
Login
0 Comments