scripting@wanadoo.nl




Join()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site     internal function since 4.10 close
9 January 2002 Join()
AuthorScriptLogic Corporation
Action Combine the elements from an array into a single, concatenated string.
SyntaxJoin (Array, Delimiter, Count) 
Parameters
  • Array (Required / Array) The array containing the elements to combine.
  • Delimiter (Optional / String) String character(s) to insert between the elements of the array when combining them into the return string.
  • Count (Optional / Numeric) Maximum element of the array to concatenate to the string. If not specified, all elements of the array will be combined into the return string. 
  • Remarks**Due to popular request, this function will become native to KiXtart 4.10**

    See also: JoinRev() 
    ReturnsReturns a single string built by concatenating the elements of the array. 
    DependenciesNone. 
    Examples
    $MyArray='red','orange','yellow','green','blue'
    ?'No Delim: '+Join($MyArray)
    ?'Space Delim: '+Join($MyArray,' ')
    ?'Tilde Delim, limited to elements (0-2): '+Join($MyArray,'~',2)
    
     
    Source
    FUNCTION Join ($array, OPTIONAL $delimiter, OPTIONAL $maxcount)
      DIM $count
      IF VarType($delimiter) = 0 ; not passed
        $delimiter=''
      ENDIF
      IF VarType($maxcount) = 0 ; not passed
        ; remember, array starts at element 0!
        $maxcount=UBound($array)
      ENDIF
    
      $join=''
      $count=0
      FOR EACH $element IN $array
        IF ($count <= $maxcount)
          $join=$join+$element+$delimiter
        ENDIF
        $count=$count+1
      NEXT
      $join=Substr($join,1,Len($join)-Len($delimiter))
    ENDFUNCTION ; - Join -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter