Sign in to follow this  
Followers 0
mrtweaver

Strip Spaces over certain limit

7 posts in this topic

I am fairly new to this Autoit so i am looking for some help and guidance on how to get started on the following. I know what i want to do but just can not figure out how to do it.

I have this file which is created by the USPS, it has variable amounts of padded spaces, for example it might have 7 spaces between the first and second columns, 21 spaces between the second and third, 16 spaces between the third and fourth. etc...

Originally i had thought of using the stringstripwc with a value of 3 to strip all spaces over 2 characters, however with two of the files this will not work as they usually pad certain areas with anywhere between 2 to 4 spaces.

So I am wondering is how it would be done within autoit that 5 spaces and over would be replaced with a certain character, anything under that amount would be left alone, then i could use that character as a column delimiter in my array.

Any help or guidance greatly appreciated.

 

 

Share this post


Link to post
Share on other sites



I am fairly new to this Autoit so i am looking for some help and guidance on how to get started on the following. I know what i want to do but just can not figure out how to do it.

I have this file which is created by the USPS, it has variable amounts of padded spaces, for example it might have 7 spaces between the first and second columns, 21 spaces between the second and third, 16 spaces between the third and fourth. etc...

Originally i had thought of using the stringstripwc with a value of 3 to strip all spaces over 2 characters, however with two of the files this will not work as they usually pad certain areas with anywhere between 2 to 4 spaces.

So I am wondering is how it would be done within autoit that 5 spaces and over would be replaced with a certain character, anything under that amount would be left alone, then i could use that character as a column delimiter in my array.

Any help or guidance greatly appreciated.

 

 

Share this post


Link to post
Share on other sites

JO, SRER is not so easy for a fairly new AutoIt user  :D
Just a clue

$newtext = StringRegExpReplace($oldtext, '\h{5,}', $delimiter)

 

1 person likes this

Share this post


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
Sign in to follow this  
Followers 0