Jump to content

convert array mono in bidimens


faustf
 Share

Recommended Posts

hi guys  i  have a list in txt  with this mode

29

54,23

29

54,23

i want creat an array 2D , i use this script  but i dont know  why  second result not send  in correct box o_O

#include <Array.au3>
Local $aArrayOne_2D=FileReadToArray ("C:\Users\pc\Desktop\bookadd\tempfile.txt")
    Local $aArray2D[UBound($aArrayOne_2D)/2][2]
        Local $iLX = 0
        Local $iLY = 0

        For $i = 0 To UBound($aArrayOne_2D) - 1
            $aArray2D[$iLX][$iLY] = $aArrayOne_2D[$i]
            If NOT Mod($i ,2) Then
                ;even
                If $iLY <> 0 Then $iLY-=1
                  $iLX+=1
            Else
                ;odd
                $iLY+=1
            EndIf
        _ArrayDisplay($aArray2D)

        Next

 

Link to comment
Share on other sites

27 minutes ago, faustf said:

hi guys  i  have a list in txt  with this mode 

29

54,23

29

54,23

Could you PLEASE provide the corresponding text file (here : "tempfile.txt") as an attachment. It's a bit annoying to have to tinker this out of your text ;).

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

@faustf you have enough posts here to be able to find how to code such a simple task by yourself.  You really need to start learning by yourself.

Local $a
_FileReadToArray("tepfile.txt", $a, $FRTA_NOCOUNT)
_ArrayDisplay($a)
Local $b[(UBound($a) + 1) / 2][2]
For $i = 0 To UBound($b) - 1
    $b[$i][0] = $a[2 * $i]
    $b[$i][1] = $a[2 * $i + 1]
Next
$a = 0
_ArrayDisplay($b)

Please try hard to stop begging spoonfeeding.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...