Change of code to 'memory' version

Just starting out? Need help? Post your questions and find answers here.
miskox
User
User
Posts: 95
Joined: Sun Aug 27, 2017 7:37 pm
Location: Slovenia

Change of code to 'memory' version

Post by miskox »

Hello experts!

I went thru the manual to see if I could do this myself - no luck.

I have this code:

Code: Select all

.
.
.
	in_record$      = ReadString (0)
    For cnt1 = 1 To number_of_fields ; determines number of fields in an input file (txt sequential file, semicolon ";" delimited)
      in_level$(cnt1)  = StringField  (in_record$, cnt1, ";")

       ForEach ZaRemoveList$ ()
;   START OF A SLOW CODE?
         cfg_remove$=ZaRemoveList$ ()
         numeric_info=Val(StringField(StringField(cfg_remove$, 1, ">"), 2, "<"))
         cfg_remove$=StringField(cfg_remove$, 2, ">")
;  END OF A SLOW CODE?
         If cnt1 = numeric_info
           in_level$(cnt1)  = RemoveString (in_level$(cnt1), cfg_remove$)
         EndIf
       Next    
.
.
.
 Next cnt1
Input string looks like

Code: Select all

<12>some_code
The problematic part does this:
PART1=LEFT SIDE OF THE ">" ; <12
PART2=RIGHT SIDE OF THIS NEW string (number only) ;12 (variable numeric_info gets this value)
PART3=RIGHT SIDE OF INPUT STRING (in this case text 'some_code')

After I added this code to have an unlimited option to use more such 'control' strings (<number>some_code) this completely slowed down my program.

I guess the problematic part should be converted to 'memory version' (with *pointer) but I don't have a clue what to do).

Just had an idea: could RemoveString (or Mid()) be faster than StringField? I could just remove the '<' in the second step instead of using StringField to get the second field).

Thanks.
Saso