Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ASP Equivalent for VFP's JUSTSTEM() function
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
ASP.NET
Database:
MS SQL Server
Divers
Thread ID:
01082370
Message ID:
01082373
Vues:
10
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,
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform