I have searched all over and I couldn't find what I am looking for so any help is greatly appreciated.
I have an INI file with certain strings that have an integer value that increments:
eg.
string_1
string_2
... etc.
and I need to find what out what the maximum number is. And then I have to add a string using what the next number would be (ie. max num found +1). (Please note the strings are not necessarily in increasing order)
Thank you for your help,
Jamie
Looping Text Search
4 posts
Can you attach some examples of the way (or ways) your INI file might be formatted?
There are a bunch of sections, and then there is a particular section where the modifcations need to take place.
Consider the example below of 'Widgets':
.... *bunch of stuff not applicable* ...
[Widgets]
bluewidget=_1_0_0
special_bluewidget={'bluewidget'}
widgets_42=bluewidget
yellowwidget=_2_3_0
special_yellowwidget={'yellowwidget'}
widgets_41=yellowwidget
... etc.
Where the 42, and 41 are, is what I am referring to. I need to find the max number. But these 'widgets' aren't in any particular order.
I hope that helps you help me.
Consider the example below of 'Widgets':
.... *bunch of stuff not applicable* ...
[Widgets]
bluewidget=_1_0_0
special_bluewidget={'bluewidget'}
widgets_42=bluewidget
yellowwidget=_2_3_0
special_yellowwidget={'yellowwidget'}
widgets_41=yellowwidget
... etc.
Where the 42, and 41 are, is what I am referring to. I need to find the max number. But these 'widgets' aren't in any particular order.
I hope that helps you help me.
Fixed
I fixed that problem (by counting the number of times widgets_ was found )
Thanks for your help.
I fixed that problem (by counting the number of times widgets_ was found )
Thanks for your help.