Anyone know if this command works.
According to the Docs the syntax is outstring=mid(instring,pos,len)
which is essentially the normal usage for most basics.
Trying to use it, and the Compiler hangs on the line.
Or any other easy way of searching long strings for shorter strings.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Mid is just an empty shell function in string.h at the moment.
There is an INSTR function which searches a source string for a find string and returns its position in the source string if its found or returns 0 if not. I haven't used it myself but it looks complete. The syntax would be foundpos = Instr(instring, findstr)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Maurie,
If you take a look at "string.h " in include/lowlevel directory , you can see that "mid" is an empty command . It's not yet a GCBASIC command .On the other hand , "Instr" function cans help you .
So, you can create a such subroutine by trying this ( I don't know if it's working ) :
First you must define the string's length as described by Kent in : http://sourceforge.net/projects/gcbasic/forums/forum/579126/topic/3563434
by writing "lenstring=instring(0)" …
Then , you'll find any character with instring( pos) . You just have to "dim character as string *lenstring " : for npos= pos to …X character(npos) = instring(npos) . ("pos" is the first character you search , "pos to X" is "len" , "instring" is the string in your "mid" command and "character(pos) to character(X)" will be the characters you were searching for " )
Regards
GC
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anyone know if this command works.
According to the Docs the syntax is outstring=mid(instring,pos,len)
which is essentially the normal usage for most basics.
Trying to use it, and the Compiler hangs on the line.
Or any other easy way of searching long strings for shorter strings.
Mid is just an empty shell function in string.h at the moment.
There is an INSTR function which searches a source string for a find string and returns its position in the source string if its found or returns 0 if not. I haven't used it myself but it looks complete. The syntax would be foundpos = Instr(instring, findstr)
Hi Maurie,
If you take a look at "string.h " in include/lowlevel directory , you can see that "mid" is an empty command . It's not yet a GCBASIC command .On the other hand , "Instr" function cans help you .
So, you can create a such subroutine by trying this ( I don't know if it's working ) :
First you must define the string's length as described by Kent in :
http://sourceforge.net/projects/gcbasic/forums/forum/579126/topic/3563434
by writing "lenstring=instring(0)" …
Then , you'll find any character with instring( pos) . You just have to "dim character as string *lenstring " : for npos= pos to …X character(npos) = instring(npos) . ("pos" is the first character you search , "pos to X" is "len" , "instring" is the string in your "mid" command and "character(pos) to character(X)" will be the characters you were searching for " )
Regards
GC
Fantastic.
Thats what I need.
Thanks .