hi,

On Mon, 26 Mar 2012, sundar j wrote:
> How do i delete a sentence/line between two matching words? For example i 
> have a long paragraph starting with ABC-Start and ending with XYZ-End. I need 
> to delete all the words including ABC-Start & XYZ-End. I have gone 
> through the gambas documentation and found replace string function. However 
> it did not do the job as i expected. Any help is appreciated.
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here 
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

i'd tend to use the Mid$() function. if you got the positions of the two 
delimiters it is as easy as
concatenating the string on the left of the beginning delimiter and the string 
on the right of the
right delimiter. code is beyond words:

Dim iStart, iEnd As Integer
Dim sRest As String

iStart = InStr(sWholeText, sBegDelim)
iEnd = InStr(sWholeText, sEndDelim, iStart) + Len(sEndDelim)

sRest = Mid$(sWholeText, 0, iStart - 1) & Mid$(sWholeText, iEnd)

which then is the parts before and after the found strings.

there may be off-by-one errors, i couldn't try it, but you get the idea.

regards,
tobi

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to