Looks like Cetin's answer is a better one ... I wonder if GetFileNameWithoutExtension() is new to .NET 1.1 (the VFPToolKit was written when only 1.0 was out) or perhaps Kamel overlooked this method. Anyway, ignore my example and use Cetin's!
~~Bonnie
>Anytime you think of a VFP command or function that you want to know how to implement in .NET, the first thing you should do is go look it up in the VFP Toolkit for .NET. Here's the link:
>
>
http://foxcentral.net/microsoft/VFPToolkitNET.htm>
>Download it!! =)
>
>To do a JUSTSTEM() function, here's what you need to do:
>
>public static string JustStem(string cPath)
>{
> //Get the name of the file
> string lcFileName = JustFName(cPath.Trim());
>
> //Remove the extension and return the string
> if(lcFileName.IndexOf(".") == -1)
> return lcFileName;
> else
> return lcFileName.Substring(0, lcFileName.LastIndexOf('.'));
>}
>
>public static string JustFName(string cFileName)
>{
> //Create the FileInfo object
> FileInfo fi = new FileInfo(cFileName);
> //Return the file name
> return fi.Name;
>}
>
>
>~~Bonnie
>
>>Hi all,
>>
>>Anybody know a quick way to return just the path out of a complete file/pathname, just like the VFP JUSTSTEM() function, from a string variable in an ASP.NET 2.0 page?
>>
>>We've tried Path.GetDirectoryName(), messing with the Request.PhysicalPath value and several other options. Nothing seems to work well -- and I just know *ONE* of the loyal UT folks has an easy way to do this.
>>
>>Anybody???
>>
>>TIA,