Search the Community

Showing results for tags 'array unique associative'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Chat
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 1 result

  1. A globally unique identifier (GUID) is a unique reference number used as an identifier in computer software. The chance of 2 GUIDs being generated is highly unlikely, though not impossible. Source: https://en.wikipedia.org/wiki/Globally_unique_identifier #include <Array.au3> #include <StringConstants.au3> #include <WinAPICom.au3> Example() Func Example() Local $aArray[1000] For $i = 0 To UBound($aArray) - 1 $aArray[$i] = _WinAPI_CreateGUID() Next Local $hTimer = TimerInit() Local $bReturn = _ArrayUniqueFast($aArray, True) ; The standard _ArrayUnqiue() is very slow when using large arrays. ConsoleWrite('Time: ' & TimerDiff($hTimer) & @CRLF) ConsoleWrite('Return: ' & $bReturn & @CRLF) _ArrayDisplay($aArray) ; The last index should be 9999. This shows that _WinAPI_CreateGUID is unique. EndFunc ;==>Example Func _ArrayUniqueFast(ByRef $aArray, $bIsCaseSensitive = False) Local Const $AUF_DELIM = ChrW(160), $AUF_LENGTH = 2, $AUF_LOCAL = 1 Local $sOutput = '', $sString = '' For $i = 0 To UBound($aArray) - 1 $sString = StringTrimLeft(StringToBinary($bIsCaseSensitive ? $aArray[$i] : StringLower($aArray[$i])), $AUF_LENGTH) If Not IsDeclared($sString) Then Assign($sString, 0, $AUF_LOCAL) $sOutput &= $aArray[$i] & $AUF_DELIM EndIf Next $sOutput = StringTrimRight($sOutput, StringLen($AUF_DELIM)) $aArray = StringSplit($sOutput, $AUF_DELIM, BitOR($STR_ENTIRESPLIT, $STR_NOCOUNT)) If @error Then Local $aTemp[0] $aArray = $aTemp EndIf Return UBound($aArray) > 0 EndFunc ;==>_ArrayUniqueFast