|
The QMChange() function replaces occurrences of one substring with another in a string. It is analogous to the QMBasic CHANGE() function.
The function arguments are:
| Src | is the string to be processed. |
| OldStr | is the substring to be replaced. |
| NewStr | is the replacement substring. |
| Occurrences | is the number of occurrences of OldStr to be replaced. If omitted or specified as less than one, all occurrences are replaced. Note that the Visual Basic 2005 API passes this argument by reference. |
| Start | is the occurrence number from one of the first occurrence of OldStr to be replaced. If omitted or less than one, replacement commences at the first occurrence of OldStr. Note that the Visual Basic 2005 API passes this argument by reference. |
The QMChange() function returns a new string with the specified substrings replaced. This function is evaluated on the client system and does not require a server connection to be open.
One typical use of QMChange() is to replace mark characters with carriage return / line feed pairs when transferring data from a dynamic array to a multi-line text box.
The examples below change three uppercase letter "A" to lowercase "a" in the supplied string starting at the second occurrence, returning the result.
char * QMChange(char * Src, char * OldStr, char * NewStr, int Occurrences, int Start)
X = QMChange("ABRACADABRA", "A", "a", 3, 2);
The memory allocated to receive the result of the QMChange() function must be released using QMFree() when no longer required.
|
QMChange(ByVal Src as String, ByVal OldStr as String, ByVal NewStr as String, Optional ByVal Occurrences as Integer, Optional ByVal Start as Integer) as String
X = QMChange("ABRACADABRA", "A", "a", 3, 2)
The Occurrences and Start arguments are optional, defaulting to zero and one respectively.
|
This function is not supported by the QMClient class module as it is a QMBasic function.
|
String Change(String Src, String OldStr, String NewStr, int Occurrences, int Start)
X = qm.Change("ABRACADABRA", "A", "a", 3, 2);
|
Change(Src, OldStr, NewStr, Occurrences, Start)
X = qm.Change("ABRACADABRA", "A", "a", 3, 2)
The Occurrences and Start arguments are optional, defaulting to zero and one respectively.
|
|