Type | Description | |||
String | A string expression that indicates the name of the file being loaded or saved. |
The following VB sample extracts the name of the file from the path:
Private Function title(ByVal s As String) As String Dim i As Long i = InStrRev(s, "\") If i > 0 Then title = Right(s, Len(s) - i) Else title = s End If End Function
The following C++ sample extracts the name of the file from the path:
CString title( LPCTSTR szFileName ) { CString strTitle( szFileName ); int p = strTitle.ReverseFind('\\'); if ( p >= 0 ) strTitle = strTitle.operator LPCTSTR() + p + 1; return strTitle; }
The following VB.NET sample extracts the name of the file from the path:
Private Function title(ByVal s As String) As String Dim i As Long i = InStrRev(s, "\") If i > 0 Then title = Microsoft.VisualBasic.Right(s, Len(s) - i) Else title = s End If End Function
The following C# sample extracts the name of the file from the path:
private string title(string szFilename) { string strTitle = szFilename; int p = strTitle.LastIndexOf('\\'); if (p >= 0) strTitle = strTitle.Substring(p + 1); return strTitle; }
The following VFP sample extracts the name of the file from the path:
local strTitle, p strTitle = thisform.Edit1.FileName p = rat('\',strTitle) if ( p > 0 ) strTitle = substr(strTitle,p + 1) endif wait window strTitle