Jump to content

Reading between the lines? (Substrings)


Rad
 Share

Recommended Posts

Ok this time I'm wondering if theres a simple way to get strings seperated by either commas or |'s. I have no idea what thats called, anyways...

I have it set so I can just use the position + length but I have to do that eight times for 16 variables which can be a pain.

Example of the string I need to seperate into eight parts: "1.00,1.50,2.00,0.75,2.00,0.35,0.50,0.05"

Now I know I can do that one that finds the occurance of a comma, then mix that with the position and length one.. but that would still be very anoying.

Link to comment
Share on other sites

  • Moderators

Try this:

Local $String = "1.00,1.50,2.00,0.75,2.00,0.35,0.50,0.05"
Local $Split = StringSplit($String, ',')
Local $Output
For $i = 1 To $Split[0]
    $Output = $OutPut & $Split[$i] & @LF
Next
MsgBox(0, 'Test', StringTrimRight($Output, 1))

Edit: Put in StringTrimRight to get rid of the last @LF

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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