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)
{
string lcFileName = JustFName(cPath.Trim());
if(lcFileName.IndexOf(".") == -1)
return lcFileName;
else
return lcFileName.Substring(0, lcFileName.LastIndexOf('.'));
}
public static string JustFName(string cFileName)
{
FileInfo fi = new FileInfo(cFileName);
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,