/
Forside
/
Teknologi
/
Udvikling
/
VB/Basic
/
Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn
*
Kodeord
*
Husk mig
Brugerservice
Kom godt i gang
Bliv medlem
Seneste indlæg
Find en bruger
Stil et spørgsmål
Skriv et tip
Fortæl en ven
Pointsystemet
Kontakt Kandu.dk
Emnevisning
Kategorier
Alfabetisk
Karriere
Interesser
Teknologi
Reklame
Top 10 brugere
VB/Basic
#
Navn
Point
1
berpox
2425
2
pete
1435
3
CADmageren
1251
4
gibson
1230
5
Phylock
887
6
gandalf
836
7
AntonV
790
8
strarup
750
9
Benjamin...
700
10
tom.kise
610
select part of string
Fra :
asd987
Dato :
03-05-04 12:19
Hi,
Is it possible to find a certain part in a string? I need the last part of
the string which is after the last backslash in the string. The string can
contain more than one backslah but i never know how much.
Example:
f:\Dir1\Dir2\Dir3\Filename.Ext.
What I need is Filename.Ext
Thanks.
Anton (
03-05-2004
)
Kommentar
Fra :
Anton
Dato :
03-05-04 13:41
Try to look at Split()
/AV
"asd987" <asd987@home.nl> skrev i en meddelelse
news:c759rh$i9p$1@news5.tilbu1.nb.home.nl...
> Hi,
>
> Is it possible to find a certain part in a string? I need the last part
of
> the string which is after the last backslash in the string. The string can
> contain more than one backslah but i never know how much.
>
> Example:
>
> f:\Dir1\Dir2\Dir3\Filename.Ext.
> What I need is Filename.Ext
>
> Thanks.
>
>
Jørgen Bondesen (
03-05-2004
)
Kommentar
Fra :
Jørgen Bondesen
Dato :
03-05-04 20:53
Hi asd987
Try this:
'snip from
'Ole Sørensen 20040430
Dim sTmp As String
sTmp = "C:\Dokumenter og test\jbotester\test1\test2\testigenigenigen3.xls"
' Split path
Dim sTemp() As String
sTemp() = Split(sTmp, "\")
' Count number of elements in sTemp()
Dim nAntalElementer As Integer
nAntalElementer = 0
Dim vElement As Variant
For Each vElement In sTemp
nAntalElementer = nAntalElementer + 1
Next
'here you are
MsgBox sTemp(nAntalElementer - 1)
Best regards from
Jørgen Bondesen
"Anton" <anton_dk@hotmail.com> wrote in message
news:40963e25$0$254$edfadb0f@dread11.news.tele.dk...
> Try to look at Split()
> /AV
> "asd987" <asd987@home.nl> skrev i en meddelelse
> news:c759rh$i9p$1@news5.tilbu1.nb.home.nl...
> > Hi,
> >
> > Is it possible to find a certain part in a string? I need the last part
> of
> > the string which is after the last backslash in the string. The string
can
> > contain more than one backslah but i never know how much.
> >
> > Example:
> >
> > f:\Dir1\Dir2\Dir3\Filename.Ext.
> > What I need is Filename.Ext
> >
> > Thanks.
> >
> >
>
>
Tomas Christiansen (
03-05-2004
)
Kommentar
Fra :
Tomas Christiansen
Dato :
03-05-04 21:36
asd987 wrote
>I need the last part of the string which is after the last backslash
> in the string.
> f:\Dir1\Dir2\Dir3\Filename.Ext.
> What I need is Filename.Ext
A simple solution could be:
f = "f:\Dir1\Dir2\Dir3\Filename.Ext"
MsgBox Mid(f, InStrRev(f, "\") + 1)
-------
Tomas
Søg
Alle emner
Teknologi
Udvikling
VB/Basic
Indstillinger
Spørgsmål
Tips
Usenet
Reklame
Statistik
Spørgsmål :
177558
Tips :
31968
Nyheder :
719565
Indlæg :
6408915
Brugere :
218888
Månedens bedste
Årets bedste
Sidste års bedste
Copyright © 2000-2024 kandu.dk. Alle rettigheder forbeholdes.