Sign in to follow this  
Followers 0
SaguratuS

Here's a small challenge

3 posts in this topic

#1 ·  Posted (edited)

Well, I have a slight problem - I need to turn this string into an array.

2207.0       0.07        12.2         257         239         249         473

Spacing varies between the variables, and are most unfortunately not tabs.

Here's an example

2207.0      10.07       112.2         257       51239         249         473 
      2208.0         0.07        12.2         257         239         249         473 
      2209.0         0.07        12.2          57          39         249          73

Any ideas, orr is this simply a dead end?

Edit: Spacing isn't showing up even as CODE, but there entire line is X characters long (with about 8-10 spaces inbetween each value) regardless of the numbers.

Edited by SaguratuS

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Something like ? :

$Var = "2207.0 0.07 12.2 257   239 249  473"
While StringInstr($var, "  ")
        $var = StringReplace($var, "  ", " ")  ;  doesn;t show but first " " has 2 spaces ... second " " has one  
Wend
$array = stringsplit($var," ")
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Something like ? :

$Var = "2207.0 0.07 12.2 257   239 249  473"
While StringInstr($var, "  ")
        $var = StringReplace($var, "  ", " ") ;  doesn;t show but first " " has 2 spaces ... second " " has one  
Wend
$array = stringsplit($var," ")
Ah, didn't even think about using while to do the job - Thanks a ton!

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