#include <Array.au3>
Dim $Array[5] = ["Maus", "aus", "us", "s",'Taus']
$aTemp = __ArrayUnique($Array)
_ArrayDisplay($aTemp, "Huch!")



; #FUNCTION# ====================================================================================================================
; Name...........: _ArrayUnique
; Description ...: Returns the Unique Elements of a 1-dimensional array.
; Syntax.........: _ArrayUnique($aArray[, $iDimension = 1[, $iBase = 0[, $iCase = 0[, $vDelim = "|"]]]])
; Parameters ....: $aArray - The Array to use
;                  $iDimension  - [optional] The Dimension of the Array to use
;                  $iBase  - [optional] Is the Array 0-base or 1-base index.  0-base by default
;                  $iCase  - [optional] Flag to indicate if the operations should be case sensitive.
;                  0 = not case sensitive, using the user's locale (default)
;                  1 = case sensitive
;                  2 = not case sensitive, using a basic/faster comparison
;                  $vDelim  - [optional] One or more characters to use as delimiters.  However, cannot forsee its usefullness
;                  $iFlag - flag = 0 (default), it acts each included in the delimiter character as a separator mark
;                           flag = 1, it is the entire separator string used as a separator mark
;                           flag = 2, turned off the return of the number in the first element. Thus, the array is 0-based.
;                                     It has to be now UBound () the size of the array.
; Return values .: Success - Returns a 1-dimensional array containing only the unique elements of that Dimension
;                  Failure - Returns 0 and Sets @Error:
;                  0 - No error.
;                  1 - Returns 0 if parameter is not an array.
;                  2 - Array dimension is invalid, should be an integer greater than 0
; Author ........: SmOke_N
; Modified.......: litlmike, [Kleiner (:.AutoIT.de.:)]
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func __ArrayUnique(Const ByRef $aArray, $iDimension = 0, Const $iBase = 0, Const $iCase = 0, $vDelim = '|', Const $iFlag = 0)
	If Not IsArray($aArray) Or UBound($aArray, 0) > 2 Then Return SetError(1, 0, -1)
	If ($iFlag < 0 Or $iFlag > 2) Then Return SetError(3, 0, -2)
	If ($vDelim = '|' Or Not $vDelim) Then $vDelim = Chr(01)
	Local $iUboundDim = UBound($aArray)
	Local $sHold
	If Not UBound($aArray, 2) Then
		For $I = $iBase To $iUboundDim - 1
			If Not StringInStr($sHold & $vDelim, $vDelim & $aArray[$I] & $vDelim, $iCase) Then $sHold &= $vDelim & $aArray[$I]
		Next
	Else
		If ($iDimension > (UBound($aArray, 2) - 1) Or $iDimension < 0) Then Return SetError(3, 0, -2)
		For $I = $iBase To $iUboundDim - 1
			If Not StringInStr($sHold & $vDelim, $vDelim & $aArray[$I][$iDimension] & $vDelim, $iCase) Then $sHold &= $vDelim & $aArray[$I][$iDimension]
		Next
	EndIf
	If $sHold Then Return StringSplit(StringTrimLeft($sHold, StringLen($vDelim)), $vDelim, $iFlag)
	Return SetError(2, 0, 0)
EndFunc   ;==>__ArrayUnique