Jump to content

Help with Trims


Recommended Posts

Hi everyone! I've a doubt (think it's a bit rookie) but i'm in fact rookie with Autoit ;)

My doubt is that i'm trying to use StringTrimLeft with a variable that contains a string and doesn't work.

If you use the function with the string "+something+something", and you want to trim the first character there's no problem, but if you use a var like $foo = "+something+something" and then you want to trim it like StringTrimLeft($foo,1) there's no trim after using the function.

I would like to know if there's any way to do that (abviously i'm using a var because the value i'm expecting changes every spin of the loop).

Thanks in advance :blink:

Link to comment
Share on other sites

It's part of a big code, but the values of $KW comes from a ExcelReadCell of an Excel sheet and are of the tipe foo,fooo

The trim is inside the first conditional, after the For bucle.

For $j=1 To UBound($KW) Step +1
      For $i=2 To UBound($KW) Step +1
        If $KW[$i][$j] <> "*" Then
            $split=StringSplit($KW[$i][$j],",") 
                $query=""
                For $z=1 To $split[0] Step +1
                    ConsoleWrite($split[$z] & @CRLF)
                    $query = $query & "+" & $split[$z]
                Next

                StringTrimLeft($query,1)
                $queries[$count] = $query
                                ConsoleWrite ("any changes?: " & $queries[$count])
                $count+=1
        Else ; no hay mas KW en esta temática
            If ($KW[$i][$j] = "*") Then
                ExitLoop
            EndIf
        EndIf   
    Next

    If ($KW[1][$j+1] = "*") Then
        ExitLoop
    EndIf
Next

I don't know why your example works, but when i try with my code doesn't work :s

Thanks for your help!!

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