Sign in to follow this  
Followers 0
Hest

Formating a string

4 posts in this topic

I have tried different string functions, but cant figure this one out.

I have this string (exactly as written):

<REPLY get(1, info)>

1 ECoS

1 ProtocolVersion[0.1]

1 ApplicationVersion[1.1.2]

1 HardwareVersion[1.4]

<END 0 (OK)>

<REPLY get(10, size)>

10 size[3]

<END 0 (OK)>

I need to put everything with a number in front into an array and still be able to count the number of arrays that has 1 or 10 or whatever number is in front (the numbers in front will change)

Something like this:

$array[1][0] = Ecos

$array[1][1] = ProtocolVersion[0.1]

$array[1][2] = ApplicationVersion[1.1.2]

$array[1][3] = HardwareVersion[1.4]

$array[10][0] = size[3]

How exactly do I have to do that. Or is there a better way.


Software:Model Train Calculator (Screen)Autoit3 beginner!

Share this post


Link to post
Share on other sites



I have tried different string functions, but cant figure this one out.

I have this string (exactly as written):

<REPLY get(1, info)>

1 ECoS

1 ProtocolVersion[0.1]

1 ApplicationVersion[1.1.2]

1 HardwareVersion[1.4]

<END 0 (OK)>

<REPLY get(10, size)>

10 size[3]

<END 0 (OK)>

I need to put everything with a number in front into an array and still be able to count the number of arrays that has 1 or 10 or whatever number is in front (the numbers in front will change)

Something like this:

$array[1][0] = Ecos

$array[1][1] = ProtocolVersion[0.1]

$array[1][2] = ApplicationVersion[1.1.2]

$array[1][3] = HardwareVersion[1.4]

$array[10][0] = size[3]

How exactly do I have to do that. Or is there a better way.

Get down and geeky with StringRegExp().

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Get down and geeky with StringRegExp().

:P

Thx :P but can you guide me a little more.

Do I need to use stringsplit() first and then stringregexp() to check every string in the array?


Software:Model Train Calculator (Screen)Autoit3 beginner!

Share this post


Link to post
Share on other sites

Thx :P but can you guide me a little more.

Do I need to use stringsplit() first and then stringregexp() to check every string in the array?

If you're not up to RegExp, then:

1. Use StringInStr() to find the first SPACE in each line

2. StringLeft() to get the part before the first space

3. StringIsInt() will tell you if that part is an integer

4. If it is an integer, process the rest of the line as required, else skip it

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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