Jump to content

Recommended Posts

Posted (edited)

Depends on what is in $myArray.

#include <Array.au3>
Dim $myarray[2]
$myarray[0] = 'Hello world'
$myarray[1] = 'Ola senior!'

msgbox(0,'Default', $myarray[0] & @LF & $myarray[1])

StringTrimLeft($myarray, 3)

msgbox(0,'StringTrimLeft', $myarray[0] & @LF & $myarray[1])

_ArrayTrim($myarray, 3)

msgbox(0,'_ArrayTrim', $myarray[0] & @LF & $myarray[1])

Note that StringTrimLeft, didn't do anything, because a) It doesn't work on arrays, and :( It doesn't affect the variable by reference, it returns the changed string.

In fact, if you do this:

Dim $myarray[2]
$myarray[0] = 'Hello world'
$myarray[1] = 'Ola senior!'

$myarray = StringTrimLeft($myarray, 3)
msgbox(0,'Default', $myarray[0] & @LF & $myarray[1])

You get an error because $myarray is no longer an array.

I can't actually see how you assumed that either of them do the same thing at all. Did you even try them first?

Edited by Saunders
Posted

no, i didn't try them first.. this is new ground for me and i did not know how to test it to this degree

You gave an absolutely perfect example............ thank you

8)

NEWHeader1.png

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...