Re: [Gambas-user] Delete sentance between words in a file.

2012-03-28 Thread Rolf-Werner Eilert
Just

 D = B + C  'Combine both together

D = B  C

should be correct, right?

Regards

Rolf

--
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


Re: [Gambas-user] Delete sentance between words in a file.

2012-03-28 Thread nando
Yup.
Too much beer.


-- Original Message ---
From: Rolf-Werner Eilert eilert-sprac...@t-online.de
To: gambas-user@lists.sourceforge.net
Sent: Wed, 28 Mar 2012 11:58:43 +0200
Subject: Re: [Gambas-user] Delete sentance between words in a file.

 Just
 
  D = B + C  'Combine both together
 
 D = B  C
 
 should be correct, right?
 
 Regards
 
 Rolf
 
 --
 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
--- End of Original Message ---


--
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


Re: [Gambas-user] Delete sentance between words in a file.

2012-03-27 Thread tobi
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 amp; 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


Re: [Gambas-user] Delete sentance between words in a file.

2012-03-27 Thread nando
An Very Simplified Example:
(Best viewed in fixed-width font)
(There are many other (and better) ways to do this)

A = A Tall Lad Sold All The Desks
'12345678901234567890123456789   29 characters long
R =   Tall Lad Sold All TheThis sub string is to be removed (21 chars 
long)
'Remove^ Remove R from within A  

X = INSTR$(A, R)   'This will make X = 3
Y = X + LEN(R) 'This will make Y = 3 + 21 = 24

'we want to remove starting from the 'T' in Tall to the 'e' in The
'What we're really doing is:
'...keep everything starting at the beginning up to the 'T' in Tall but not 
including it
'...and starting after the 'e' in The to the end

B = MID$(A,1,X - 1)'Keep the first part : Position 1...(X-1) = 1..2
C = MID$(A,Y)  'Keep the second part: Position 24 ..end  = 24..29

D = B + C  'Combine both together

PRINT D 
'result: D = A  Desks




-- Original Message ---
From: tobi tobiasboeg...@googlemail.com
To: sundar_...@rediffmail.com, mailing list for gambas users
gambas-user@lists.sourceforge.net
Sent: Tue, 27 Mar 2012 17:06:39 +0200
Subject: Re: [Gambas-user] Delete sentance between words in a file.

 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 amp; 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
--- End of Original Message ---


--
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


Re: [Gambas-user] Delete sentance between words in a file.

2012-03-26 Thread Emil Lenngren
Maybe you want to use a regular expression?

2012/3/26 sundar j sundar_...@rediffmail.com

 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 amp; 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

--
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