Jump to content

manupilation tru string


Recommended Posts

hello,

i have a excel sheet with 2100 lines. and almost on each row I need to change a value. So I hope it can be solved with autoit :)

well this is my problem almost all have too much space value insert so I am trying to make a script where I can read each value. done that with _array commands. I now need to try to code the following.

Where the returned value have 2 spaces or more it need to split it and enter the value after the 2 spaces into a other column

Example:

This is how my excel sheet is now
collum1                 collum2
Jdfhdfjd dfddf   dfdfdfdfdfdf
Dsjkfkjsdfkj dfsdfsdf
Ewqexxcz    vbvdfv34 df2


After my script it must be looking like this.
collum1                 collum2
Jdfhdfjd dfddf              dfdfdfdfdfdf
Dsjkfkjsdfkj dfsdfsdf
Ewqexxcz        vbvdfv34 df2

I hope I could explain my situation properly and you guys would like to help me.

Link to comment
Share on other sites

hello,

i have a excel sheet with 2100 lines. and almost on each row I need to change a value. So I hope it can be solved with autoit :D

well this is my problem almost all have too much space value insert so I am trying to make a script where I can read each value. done that with _array commands. I now need to try to code the following.

Where the returned value have 2 spaces or more it need to split it and enter the value after the 2 spaces into a other column

Example:

This is how my excel sheet is now
collum1                 collum2
Jdfhdfjd dfddf   dfdfdfdfdfdf
Dsjkfkjsdfkj dfsdfsdf
Ewqexxcz    vbvdfv34 df2


After my script it must be looking like this.
collum1                 collum2
Jdfhdfjd dfddf              dfdfdfdfdfdf
Dsjkfkjsdfkj dfsdfsdf
Ewqexxcz        vbvdfv34 df2

I hope I could explain my situation properly and you guys would like to help me.

Here is an answer to what I believe you problem is. It may give you a few ideas.

;
#include <Array.au3>

Local $ArrayFromExcel[3] = ["ArrayJdfhdfjd dfddf     dfdfdfdfdfdf", _
                            "Dsjkfkjsdfkj dfsdfsdf", _
                            "Ewqexxcz    vbvdfv34 df2"]
Local $RE

Local $ArrayWrite2Excel[UBound($ArrayFromExcel)][2]

For $x = 0 To UBound($ArrayFromExcel) - 1
    $RE = StringRegExp($ArrayFromExcel[$x], "(.*) {2,}(.*)", 3)
    If IsArray($RE) Then
        $ArrayWrite2Excel[$x][0] = $RE[0]
        $ArrayWrite2Excel[$x][1] = $RE[1]
    Else
        $ArrayWrite2Excel[$x][0] = $ArrayFromExcel[$x]
        $ArrayWrite2Excel[$x][1] = ""
    EndIf
Next
; Write the array $ArrayWrite2Excel to excel sheet
_ArrayDisplay($ArrayWrite2Excel)
;
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...