SOME STRING HANDLING KEYWORDS

This chapter explains some keywords concerning string handling. You should have read the chapter of this manual concerning strings first.

MKSTRING$

Sometimes, some of the query or change tags do not return a string, but a pointer to a string. This is an address where the string lies in the completely useless 'C' format. The MKSTRING$ function looks at the string located at that address, and returns it to SBasic as a real string.

Syntax:

String$=MKSTRING$(address)

Example:

         l_item_t=PWquery(my_loose_item_object,PW
    ('LOOSE_TEXT',))
         item_text$=MKSTRING(l_item_t) 
    

This queries the item and gets a pointer to the text of the item from it, and then makes a string out of this, which is returned in item_text$.

MKLEN

Some of the ProWesS calls will set a string passed to them to a new value. Of course, ProWesS only sets this in the 'C' format - i.e. it forgets to make the new length of the string. MKLEN does that - it makes sure that a string passed to it will be so long that is stops just before the first CHR$(0) in that string. Use only when the string was modified by ProWesS, i.e. when it is a call and return parameter to ProWesS. The length of the string that will be set does not count the CHR$(0) at the end - in other words, this will no longer be part of the SBasic string.

Syntax: MKLEN string$ page 1

MKLEN0

This does the same as MKLEN, but keeps the CHR$(0) at the end.

Both of these keywords should be used ONLY when you are sure that there is, indeed, a CHR$(0) at the end. If not, and especially in a compiled program, it could happen that the variable stops where another starts - without a CHR$(0) to separate them! The new length would then count until the first CHR$(0), i.e. at the end of the nxt variable (perhaps!).


PROGS, Professional & Graphical Software
last edited 1996 1996 Sep 14 (wl)
page 2