'=========================================================================== ' Subject: SEARCH AND REPLACE STRING Date: 01-20-98 (16:15) ' Author: Dave Navarro, Jr. Code: PBDLL ' Origin: dave@powerbasic.com Packet: PBDLL.ABC '=========================================================================== '============================================================================== ' ' Visual Basic example for PB/DLL ' Copyright (c) 1996 by PowerBASIC, Inc. ' ' Return a string value. Requires VBAPI.INC. ' ' Visual Basic Declare: ' ' Declare Sub Replace Lib "REPLACE.DLL" (ByVal a$, ByVal b$, c$) ' ' Syntax: ' REPLACE a$, b$, c$ ' ' a$ = The data you want to search for in c$ ' b$ = The data you want to to replace in c$ ' c$ = The string you want to search ' ' Example: ' ' c$ = "This is my time to shine!" ' REPLACE "is", "IS", c$ ' ' Result: ' "ThIS IS my time to shine!" ' ' '------------------------------------------------------------------------------ $COMPILE DLL $INCLUDE "WINAPI.INC" $INCLUDE "VBAPI.INC" SUB pbReplace ALIAS "REPLACE" (a AS ASCIIZ, _ b AS ASCIIZ, _ BYVAL c AS DWORD) EXPORT DIM d AS STRING ' temporary PowerBASIC string d = VbStringToPb(c) ' convert VB string to PB string REPLACE a WITH b IN d ' do the replace vbSetHlstr c, STRPTR(d), LEN(d) ' update c$ with new value END SUB