|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Member
Iscritto dal: Oct 2001
Messaggi: 57
|
[VB] etrarre solo il nome del file senza estensione
Forse per voi domanda facile....
Tramite un settaggio su un text va una cosa del tipo: c:\windows\nomefile.txt voglio che venga estratto solo nomefile. Mi sapreste dire come? Grazie mille. |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Feb 2001
Città: Nordest
Messaggi: 217
|
Una funzione buttata giù in fretta:
Codice:
Public Function GetFileName(pathname As String) As String Dim p1 As Integer Dim p2 As Integer Dim temp As String 'toglie path Do p1 = p2 p2 = InStr(p1 + 1, pathname, "\") Loop Until p2 = 0 temp = Right$(pathname, Len(pathname) - p1) 'toglie estensione p1 = InStr(temp, ".") If p1 > 0 Then temp = Left$(temp, p1 - 1) GetFileName = temp End Function |
![]() |
![]() |
![]() |
#3 |
Member
Iscritto dal: Oct 2001
Messaggi: 57
|
RE
Grazie per l'aiuto
|
![]() |
![]() |
![]() |
#4 |
Senior Member
Iscritto dal: Feb 2000
Città: Frittole
Messaggi: 2596
|
solonome=left(nomecompleto,instr(nomecompleto,".")-1)
Bye !!
__________________
Ryzen7 5800x ASUS Prime B550 Plus GTX 1660 Super Muletto: Athlon64 3000+ @2750mhz Ciuchino: intel 80286 @8mhz ram 384kb video ega msdos3.1 floppy 5-1/4 hd 10mb. |
![]() |
![]() |
![]() |
#5 | |
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#6 |
Member
Iscritto dal: Oct 2001
Messaggi: 57
|
re
Beh forse, ma ringrazio uguale, a me basta per file con una sola estensione... poi per togliere la path basta che gli passo il fileTitle..
Grazie atutti... |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 11:46.