QMReplace()

Top  Previous  Next

 

The QMReplace() function replaces the content of a field, value or subvalue in a dynamic array.

 

 

Format

 

VBQMReplace(ByVal Src as String, ByVal Fno as Integer, ByVal Vno as Integer, ByVal Svno as Integer, ByVal NewData as String) as String

 

Cchar * QMReplace(char * Src, int Fno, int Vno, int Svno, char * NewData as String)

 

where

 

Srcis the dynamic array to be processed

 

Fnois the number of the field to be replaced. If zero, 1 is assumed. If negative, a new field is appended to the dynamic array.

 

Vnois the number of the value to be replaced. If zero, the entire field is inserted. If negative, a new value is appended to the specified field.

 

Svnois the number of the subvalue to be replaced. If zero, the entire value is inserted. If negative, a new subvalue is appended to the specified value.

 

NewDatais the new data to form the new dynamic array element.

 

 

The QMReplace() function returns a new dynamic array with the specified field, value or subvalue replaced.

 

 

Note that in the C API library, a statement of the form

rec = QMReplace(rec, 2, 0, 0, new_data)

will return a pointer to a newly allocated memory area, overwriting the rec pointer. The old memory is not freed by this call and it is therefore necessary to retain a pointer to the original rec string so that it can be freed later.