Jump to content
Sign in to follow this  
Iznogoud

Reading specific characters out a field

Recommended Posts

If you got a program wich generates key like: 12345-12345-12345-12345-12345

How can you select the first 5 and put them in a variable and the next 5 numbers/characters and so on.

So you leave the "-" alone.

Wich funtion do i need for this or how can i do this the best way?

Share this post


Link to post
Share on other sites

$var = stringsplit("12345-12345-12345-12345-12345", "-")

For $x = 1 to $var[0]

msgbox(0,"test", $var[$x])

endif

that will do the trick

8)

EDIT

thx MSLx Fanboy

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

$var = stringsplit("12345-12345-12345-12345-12345", "-")

For $x = 1 to $var[0]

msgbox(0,"test", $var[$x])

endif

that will do the trick

8)

EDIT

thx MSLx Fanboy

Maybe i am stupid :P But i am readying a line of text 12345-12345-12345-12345-12345 wich is an output of a program. But how do i get that in the stringsplit?

Is it enough to put the output in $output and make the code:

$var = stringsplit($output, "-")

For $x = 1 to $var[0]

msgbox(0,"test", $var[$x])

endif

Sorry i am a beginner to this so don't be hard on me ;)

Share this post


Link to post
Share on other sites

$output = file read line............

;;;;;;;;;;;;thus $output = "12345-12345-12345-12345-12345 "

$var = stringsplit($output, "-")

For $x = 1 to $var[0]

msgbox(0,"test", $var[$x])

endif

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

$output = file read line............

;;;;;;;;;;;;thus $output = "12345-12345-12345-12345-12345 "

$var = stringsplit($output, "-")

For $x = 1 to $var[0]

msgbox(0,"test", $var[$x])

endif

8)

Just need a little help ;)

I have this code:

$output = FileReadLine($file)

$var = stringsplit($output, "-")

FOR $x = 1 to $var[0]

msgbox(0,"test", $var[$x])

EndIF

Problem is now, i get an error wich is: "if" statements must have a "Then" keyword.

Did i make a typing error or did you forget something?

I know you got more programming skills so i think i am doing something wrong but what?

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...