Jump to content

Duplicate column in array and stringleft the value

Recommended Posts

I have an array that looks like:


And I want to have Autoit create a new column at the start and grab the first 3 characters of the next column, so the array would now look like this:


I've had a bit of a play with some of the _Array functions but can't really find anything to duplicate the column, so I'm not sure where to start.


Any help appreciated!

Link to post
Share on other sites
#include <Array.au3>

Local $array1[1][3] = [[123456,"ABCDEF",999999]]
Local $array2[UBound($array1)][UBound($array1, 2) + 1]

For $i = 0 To UBound($array1) -1
    $array2[$i][0] = StringLeft($array1[$i][0], 3)
    $array2[$i][1] = $array1[$i][0]
    $array2[$i][2] = $array1[$i][1]
    $array2[$i][3] = $array1[$i][2]



AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to post
Share on other sites
#include <Array.au3>

Local $a[2][3] = [[123456,"ABCDEF",999999],["blah","ablah","bblah"]]
ReDim $a[UBound($a)][4]

For $i = 0 To UBound($a)-1
    $a[$i][3] = $a[$i][2]
    $a[$i][2] = $a[$i][1]
    $a[$i][1] = $a[$i][0]
    $a[$i][0] = StringLeft($a[$i][0],3)


edit: beat me by this much *fingers very close together*

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...