Sign in to follow this  
Followers 0
6105

search in array

7 posts in this topic

Hi Guys,

i have it:

#include <File.au3>
#include <Array.au3>
$map = @AppDataDir&"/skype"
$List=_FileListToArray($map, "*", 2)
Global $Array[UBound($List)][2]
For $i = 1 To $List[0]
    $Array[$i][0] = $List[$i]
Next
_ArrayDisplay($Array)

Result:

Col0:

skypelogin
My Skype Received Files
shared_dynco
shared_html
shared_httpfe
anogherskypelogin

how i can to sort this array? to be without "shared_" and "My Skype"

Thank you. :x


[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

try this

#include <File.au3>
#include <Array.au3>
$map = @AppDataDir&"/skype"
$List=_FileListToArray($map, "*", 2)
Global $Array[UBound($List)][2]
For $i = 1 To $List[0]
    $Array[$i][0] = StringRegExpReplace ( $List[$i], "(shared_|My Skype )", "" )
Next
_ArrayDisplay($Array)
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

wow. its great! thank you!

#include <File.au3>
#include <Array.au3>
$map = @AppDataDir&"/skype"
$List=_FileListToArray($map, "*", 2)
Global $Array[UBound($List)][2]
For $i = 1 To $List[0]
    $Array[$i][0] = StringRegExpReplace ( $List[$i], "(shared_dynco|shared_html|shared_httpfe|My Skype Received Files)", "" )
Next
$slash = _ArrayFindAll($array,"")
For $i = 0 to ubound($slash) - 1
    If $i <> 0 Then
        $slash[$i] = ($slash[$i]) - $i
        Endif
_ArrayDelete ($array , $slash[$i])
 Next
_ArrayDisplay($Array)

[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Share this post


Link to post
Share on other sites

may be

#include <File.au3>
#include <Array.au3>
$map = @AppDataDir&"/skype"
$List=_FileListToArray($map, "*", 2)
Global $Array[UBound($List)][2]
For $i = 1 To $List[0]
    $_String = StringRegExpReplace ( $List[$i], "(shared_dynco|shared_html|shared_httpfe|My Skype Received Files)", "" )
    If $_String <> '' Then $Array[$i][0] = $_String
Next
_ArrayDisplay($Array)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yep, its more nice.. but i don't know how to delete free rows, and also,

can't understand why

MsgBox(0, "_ArrayToString() getting $avArray items 1 to 7", _ArrayToString($Array, @TAB, 1, 7))
don't work

Ohh.. good, now everythink work!! Thank you!!

#include <File.au3>
#include <Array.au3>
$map = @AppDataDir&"/skype"
$List=_FileListToArray($map, "*", 2)
Global $Array[UBound($List)][2]
For $i = 1 To $List[0]
    $Array[$i][0] = StringRegExpReplace ( $List[$i], "(shared_dynco|shared_html|shared_httpfe|My Skype Received Files)", "" )
Next
$slash = _ArrayFindAll($array,"")
For $i = 0 to ubound($slash) - 1
    If $i <> 0 Then
        $slash[$i] = ($slash[$i]) - $i
        Endif
_ArrayDelete ($array , $slash[$i])
 Next
For $i = 0 to $List[0]
MsgBox(0,'',$Array[$i][0])
Next
Edited by toader

[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Share this post


Link to post
Share on other sites

Yep, its more nice.. but i don't know how to delete free rows

try

#include <File.au3>
#include <Array.au3>
$map = @AppDataDir&"/skype"
$List=_FileListToArray($map, "*", 2)
Global $Array[UBound($List)][2]
For $i = 1 To $List[0]
    $_String = StringRegExpReplace ( $List[$i], "(shared_dynco|shared_html|shared_httpfe|My Skype Received Files)", "" )
    If $_String <> '' And Not StringIsSpace ( $_String ) Then $Array[$i][0] = $_String
Next
_ArrayDisplay($Array)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Now, that don't delete the free rows, but thank you) you helps me.

have a nice night. bye.


[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0