The Daily Click ::. Forums ::. Klik Coding Help ::. parsing strings and such
 

Post Reply  Post Oekaki 
 

Posted By Message

Darkstar



Registered
  27/01/2002
Points
  12
10th July, 2004 at 06:23:25 -

This has to do with parsing strings and such, if you can help me out it'd be much appreciated.

If I had an INI setup as such...

[Animals]
5040=Dog,Cat,Cat,Mouse,Dog,Giraffe,Cat

..and I wanted to read that information in and output it as such...

2x Dog
3x Cat
1x Giraffe
1x Mouse

..what would be the most efficient way of doing this without using the keywords in the code? Thanks in advance.

 
-]Darkstar[

Shen

Possibly Insane

Registered
  14/05/2002
Points
  3497
10th July, 2004 at 08:23:18 -

Use an associative array to hold the numbers of each animal, and another string to hold the animals' names (you'll have to loop through it quite a lot). Then separate the string with a comma with string parser or something, and you should be able to go from there.

 
gone fishin'

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
10th July, 2004 at 10:19:17 -

What's wrong with running through that list once?

Start of Frame
String Parser : add delimiter ","

Your event for whatever it is
String Parser : Set internal string to the string in INI
Start "loop" for Number of Tokens in String Parser

On loop "loop"
AssArray : Set value at key Get Delimiter( LoopIndex( "loop" ) ) to value Get Value From Key( Get Delimiter( LoopIndex( "loop" ) ) ) + 1


Hopefully you'll understand that pseudocode.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click