Add to Favorites    Make Home Page 15259 Online  
 Language Categories  
 Our Services  

Home » ASP Home » Strings Home » PrettyPath Function

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title PrettyPath Function
Description PrettyPath formats a path for use in user displays. PrettyPath is useful for trimming down long directory paths or abbreviating them. No attempt is made by PrettyPath to determine the validity of the entered path's syntax or if the path already exists on the server. The output of PrettyPath is meant for display purposes only. It should not be used programmatically to pass paths to the FileSystemObject for example.

Arguments
=============

There are 4 arguments. Only the first, sPath, is required. To bypass the other three arguments, enter null as a placeholder for the argument. If you specify null for any of the last three arguments, the default will be used. Defaults for each argument are below. sPath Required. String. The path to format for display. Can be a virtual, relative or absolute path to a file or folder. hLen Optional. Integer. Default: 3 Each path element will stop being displayed after this length. Value can be 0 or greater. Regardless of the remaining characters in the element, they will be replaced with three dots as placeholders "...". Example: if hLen is 2 and the path entered is "c:winntsystem32" then PrettyPath will format the path as "c:wi...sy..." If hLen is 0, the path would be "c:......" bFile Optional. Boolean. Default: False Show the file name (if path is determined to be a file by prettypath). If set to true, the bExtOnly argument is ignored and the file name in it's entirety (including extension) is shown. Does nothing if the path entered is determined to be a directory path. bExtOnly Optional. Boolean. Default: True Show the file extension (if path is determined to be a file by PrettyPath). If True, file extension is shown. If false, extension may be removed depending on the size of hLen.
Category ASP » Strings
Hits 379344
Code Select and Copy the Code
<% Private Function PrettyPath(ByVal sPath, ByVal hLen, ByVal bFile, ByVal bExtOnly) Dim elements, i, tmp, bLast, sElm, sDelim, chopsize Dim showfullfilename, showfileextension chopsize = hLen showfullfilename = bFile showfileextension = bExtOnly If IsNull(chopsize) Then chopsize = 3 If IsNull(showfullfilename) Then showfullfilename = False If IsNull(showfileextension) Then showfileextension = True bLast = False sDelim = "" If InStr(sPath, sDelim) = 0 Then sDelim = "/" elements = Split(sPath, sDelim) For i = 0 To UBound(elements) sElm = elements(i) If Len(sElm) > 5 Then If i = UBound(elements) Then If showfullfilename Then tmp = "" Exit For ElseIf showfileextension Then tmp = Right(sElm, Len(sElm) - _ InStrRev(sElm, ".")) bLast = True End If End If If chopsize > 0 Then elements(i) = Left(sElm, chopsize) & "..." Else elements(i) = "..." End If If showfileextension And bLast Then elements(i) = elements(i) & tmp End If End If Next PrettyPath = Join(elements, sDelim) End Function %>

Related Source Codes

Script Name Author
��������������������� VyomWorld
Resistor color code reader A.Chermarajan.
Telephone Directory dhivya
card swapping game (Mini Project) nityanand
simple hangman-pascalsource Seabert
college dirtectory (Mini Project) msridhar
Poll Application John van Meter
ASP Daily Hit Counter. Tejaskumar Gandhi
To avoid null in asp environment using sql Sami
Maklumbalas webmaster
poll John van Meter
EasyASP Template Engine. TjoekBezoer
Basic Calculator using HTML & Javascript. Patrick M. D Souza
What servers support ASP ? VyomWorld
What is ASP? VyomWorld

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=206


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review