Re: Stripping letters from filename



Benway wrote:

I have a file name like Eng-Cat-01-01-01.txt. I need to do a loop that starts stripping the letters from the front of this file name (which I'll store as a variable) until it reaches the "Cat" part. So I would have a variable "Cat-01-01-01.txt" that I can use to build up another string.

Dim sFilename As String _
= "Eng-Cat-01-01-01.txt"
Dim iPos as Integer _
= sFilename.Indexof( "Cat" )

If iPos > -1 Then
? sFilename.SubString( 0, iPos )
? sFilename.SubString( iPos + "Cat".Length() + 1 )

' or thereabouts ...

HTH,
Phill W.
.



Relevant Pages

  • Re: Stripping letters from filename
    ... Phill W. wrote: ... that starts stripping the letters from the front of this file name (which I'll store as a variable) until it reaches the "Cat" part. ... If iPos> -1 Then ...
    (microsoft.public.dotnet.languages.vb)
  • Re: australian cat food comparisons ? (a bit longish)
    ... So is it worth checking out the pet stores I wonder? ... One cat just leads to another. ... > I'm not Australian but I found a large pet store ... >> food is available in all the Hills etc ranges, ...
    (rec.pets.cats.anecdotes)
  • Re: Dilemma, only marginally OT
    ... We've had complaints to management because Boss Lady asked ... I got chewed out by the store ... that cat. ... Remember the key word here was supposed to be volunteer, ...
    (rec.pets.cats.anecdotes)
  • Re: Reggie
    ... supply store, and he had clearly tested all the cat beds. ... cuddly places for Reggie to nap (Reggie is not a ... I am lucky in that a few businesses near me have shop cats. ...
    (rec.pets.cats.anecdotes)
  • Re: Dilemma, only marginally OT
    ... We've had complaints to management because Boss Lady asked ... I got chewed out by the store ... that cat. ... but I love all the Yiddish in your posts. ...
    (rec.pets.cats.anecdotes)