wwUtils is actually a UDF function library, not a class. This class provides lots of utility functions frequently used in the Web Connection framework and in typical applications. I use this library in every app I build.
Note this is a function library rather than a class, so there's no object to create first. Just SET PROCEDURE and call the functions.
Class Members
Member | Description | |
---|---|---|
AParseString |
Parses a delimited string into an array by passing a delimiter to be used to split the string. AParseString(@laResult, lcString, lcDelimiter) |
|
ArrayToCollection |
Convert a FoxPro array to a Collection. o.ArrayToCollection(@laArray,lnMode) |
|
CacheFile |
This method works like FILETOSTR() or FILE2VAR() to return the content of a file. The first time the file is read it's read from disk and then cached in a cursor. Subsequent requests for the same file (based on path + filename) retrieve the file from the cursor rather than from disk. CacheFile(lcFileName,lnRefreshSeconds) |
|
CharToBin |
Converts a DWORD value in binary string form back into a numeric value. CharToBin(tcWord) |
|
CollectionToCursor |
Updates a cursor from a collection by doing GATHER NAME MEMO for each member. An optional search expression can be provided for each item to allow updating existing records. CollectionToCursor(loCollection, lcAlias, lcSearchExpression) |
|
ContentTypeFromExtension |
Returns a content type for a given extension. For example, PDF returns applications/pdf, DOC returns application/ms-word etc. ContentTypeFromExtension(lcExtension) |
|
CopyObject |
Creates a copy of an object by creating a brand new object and copying all properties including all nested objects from scratch. CopyObject(loInput) |
|
CopyObjectProperties |
This function copies properties between two objects in a flat manner. Child objects or arrays are not taken into account - this is a single level function. o.CopyObjectProperties(loSource,loTarget,lnSourceTemplateObject, llParseObjects) |
|
CopyTree |
Copies a directory tree from one location to another o.CopyTree(lcSourceFilePath, lcTargetPath) |
|
CursorToCollection |
Easily creates a Collection from a FoxPro cursor. Creates either a FoxPro Collection or a wwCollection instance. o.CursorToCollection(lcAlias,lnMode) |
|
CursorToObjectArray |
Creates an array of objects of the currently open cursor. The result is an object that has two properties the count and the array of objects that contain the records. The object has properties for each field value (except general fields) CursorToObjectArray() |
|
DCOMCnfgServer |
Configures security rights for a Local Server (EXE server) COM object. Provides similar functionality that DCOMCNFG provides for setting the Impersonation Level of a component. Be sure to also set the DCOMLaunchPermissions. o.DCOMCnfgServer(lcProgId, lcRunAs, lcPassword) |
|
DCOMLaunchPermissions |
Sets the Launch and Access permissions of a DCOM server. o.DCOMLaunchPermissions(lcProgid,lcusername) |
|
DecodeHtml |
Decodes an Html encoded string removing basic HTML entities. o.DecodeHtml(lcEncodedHtml) |
|
DeleteFiles |
Deletes files given a file spec and a timeout or expiration value. This function is useful for quick clean up of temporary files created for Web display. o.DeleteFiles(lcFileSpec, lnTimeout) |
|
DisplayMemo |
This method formats a memo field for minimal HTML presentation by simply converting multiple linebreaks to <p> paragraph tags and linebreaks to <br> breaks. This behavior is similar to Response.WriteMemo(), but doesn't require a Response object. o.DisplayMemo(lcText) |
|
EncodeHtml |
This method fixes up HTML for display. Takes HTML and XML tags and converts them to HTML displayable characters (< for < for example). o.EncodeHtml(lcHTML) |
|
EndsWith |
Checks to see if a given string ends with a given substring. EndsWith(lcSourceString,lcCompare,llCaseInsensitive) |
|
Extract |
Extracts a text value between two delimiters. You can specify two ending delimiters or let the end of a line be considered an ending delimiter. o.Extract(lcString,lcStartDelim,lcEndDelim1,lcEndDelim2, llEndOk, llIncludeDelims) |
|
File2Var |
Retrieves a file from disk into a string, and stores a string to a file. Dual function method handles both reading and writing of strings to and from files. o.File2Var(tcFileName, tcString, tlSharedWriteMode) |
|
FileAttributes |
Retuns the file attributes of a given file. The list of attributes is returned as a single string that contains all the attributes that apply. o.FileAttributes(lcFilename) |
|
FileSize |
Returns the size of a file on disk. o.FileSize(lcFileName) |
|
FileTime |
Returns the file's last udpate DateTime value. o.FileTime(lcFileName) |
|
FixPreTags |
Fixes <PRE></PRE> blocks in HTML pages so that they display properly and can be cut and pasted as code. Replaces <p> and <br> tags with real carriage returns. o.FixPreTags(lcHTML) |
|
ForceTableRefresh |
Refreshes a table's read buffers, by explicitly moving the record pointer. This causes VFP to re-read buffers from disk, to ensure data is not coming from the data refresh cache in VFP. o.ForceTableRefresh(lcAlias) |
|
FromIsoDateString |
Converts a date in ISO 8601 format to a FoxPro date or time (if time values are specified). Input date format is 2012-10-08 which is used in HTML5 input type=date controls. o.FromIsoDateString(lcDate) |
|
GetAppStartPath |
Returns the FoxPro start path of the *APPLICATION* under all startmodes supported by VFP. o.GetAppStartPath() |
|
GetAttribute |
Retrieves the content of an attribute in an XML or HTML element. o.GetAttribute(lcElementXml,lcAttribute) |
|
GetLongPathName |
Returns a properly upper and lower cased operating system file name from a full or relative filename or path. Returns files and paths in proper case and converts short filenames to long. o.GetLongPathName(lcFileName) |
|
GetPassword |
Pops up a VFP Form Inputbox asking for a password. The password is hidden with a password mask. o.GetPassword() |
|
GetRegExObject |
Creates an instance of the VBScript.RegExp object and caches this instance in a PUBLIC variable reference. If already loaded the existing instance is returned. o.GetRegExObject |
|
GetURLEncodedKey |
Retrieves a 'parameter' from a URL Encoded string such as a QueryString or POST buffer. o.GetURLEncodedKey(tcURLString, lcKey) |
|
GetUrlEncodedValues |
Returns a wwNameValueCollection of all keys and values contained in a UrlEncoded string of key values. o.GetUrlEncodedValues(lcVars,lcPrefix) |
|
GoUrl |
ShellExecute wrapper that starts any associated program or URL. You can launch URLs, mailto: links, as well as any file like .txt, doc,.ini etc. If an association exists GoUrl() will launch the associated application with the specified document. o.GoUrl(tcUrl, tcAction) |
|
GravatarLink |
Creates a Gravatar link based on an email address. o.GravatarLink(lcEmail,lnSize,lcDefaultUrl,lcRating) |
|
Href |
Creates an <a href> tag in HTML. o.wwUtils.Href(lcLink, lcText, lcAttributes) |
|
HTMLColor |
Converts an RGB color value to an HTML color value. o.HTMLColor(lnRGBColor) |
|
InputForm |
Creates a simple VFP form input box. o.InputForm(lcValue,lcMessage,lcCaption,lnFormWidth, lnFieldWidth,lcFormat,lcCancelValue) |
|
IsCOMObject |
Checks to see if a COM object exists in the registry. o.IsCOMObject(lcProgId, @lcClassId, @lcClassDescript) |
|
IsDir |
Checks to see if a directory exists. Unlike Directory() this method works on Windows 2000. o.IsDir(lcPath) |
|
IsDotNet |
Returns whether .Net is installed. Also can return the latest installed version and directory of the .Net framework. o.IsDotNet(@lcVersion,@lcPath) |
|
IsNullOrEmpty |
Determines whether a value is NULL or empty. o.IsNullOrEmpty(lvValue) |
|
IsWinnt |
Checks to see if app is running under Windows NT. o.IsWinnt(llReturnVersionNumber) |
|
JsonDate |
Creates an ISO JSON compatible date string including quotes. o.wwUtils.JsonDate(ldDateTime) |
|
JsonString |
Creates a JSON encoded string from a FoxPro string including the wrapping quotes. o.wwUtils.JsonString(lcString) |
|
LaunchVsWebServer |
Can be used to launch the Visual Studio Web Server (webserver.webdev.exe in the .NET 2.0 Framework dir) or the Web Connection Cassini Web Server for use with the Web Connection Managed module. Cassini is similar to the Visual Studio server but can be redistributed with your applications for local Web server operation. o.LaunchVsWebServer(lcPhysical,lnPort,lcVirtual,lnType) |
|
MailLink |
Creates an email link on a Web page that is not easily harvested by breaking up the Url. o.MailLink(lcEmail,lcText,lcSubject,lcMessage) |
|
MergeText |
This function provides an evaluation engine for FoxPro expressions and code blocks in a template/script page. Default syntax format uses ASP style tags (<% %>), but can work with any set of delimiters. o.MergeText(tcString,tcDelimiter, tcDelimiter2, llNoASPSyntax) |
|
MergeTextFromFile |
Like MergeText except the content is loaded from a file. o.wwUtils.MergeTextFromFile(tcFile, tlCacheTemplate, tcDelimiter,tcDelimiter2,llNoAspSyntax) |
|
MimeDateTime |
Converts DateTime values to Mime strings or Mime Date strings to DateTime values. MimeDateTime(lvDateTime) |
|
NoEmptyDate |
Returns a fixed date time value from an empty FoxPro date. o.NoEmptyDate(ltDateTime,ltEmptyDateValue) |
|
OpenExclusive |
Opens a table exclusively if possible. o.OpenExclusive(lcTable, lcAlias) |
|
Path |
Adds or deletes items from the Visual FoxPro path string. o.Path(pcPath,pcMethod) |
|
PropertyDump |
Dumps all of an objects properties to a string separated by Carriage Returns. Note Long strings will be truncated at 80 characters. o.PropertyDump(loObject) |
|
RegisterDotNetComponent |
Registers a .NET Component for COM operation by calling regasm /codebase. o.RegisterDotNetComponent(lcDotNetDLL, lcProgId,@lcError) |
|
RegisterOleServer |
Registers an OLE server or OCX control o.RegisterOleServer(lcServerPath, llUnRegister, llSilent) |
|
RemoveUrlEncodedKey |
Removes a single key from a URL encoded string such a query string or form variable collection. o.RemoveUrlEncodedKey(lcQuery,lcKey) |
|
RenderAspScript |
Allows quick rendering of an ASP style script page that contains embedded <% %> tags for FoxPro script expressions and code blocks. Runs as a full FoxPro program. o.RenderAspScript(lcTemplate,lnMode,llIsString,llUseHttpResponse) |
|
ReplaceText |
This function is a combination of STREXTRACT() and STRTRAN() that allows you to search for a string between a pair of delimiters and then replace that string with another value. Replaces the text between the matches. ReplaceText(lcSource,lcStart,lcEnd,lcReplace) |
|
ReplaceTextAndDelimiters |
This function is a combination of STREXTRACT() and STRTRAN() that allows you to search for a string between a pair of delimiters and then replace that string with another value. Replaces the full matched text including the delimiters. ReplaceTextAndDelimiters(lcSource,lcStart,lcEnd,lcReplace,llAll) |
|
SafeCommand |
Evaluates a single FoxPro command dynamically and wraps it into a TRY/CATCH block. Uses a macro (&) operation to execute the command so anything you can do with & operation is valid with the exception of LOCAL and THIS scoped variables. o.SafeCommand(lcVfpCommand,lcErrorDisplay) |
|
SafeEval |
Evaluates a FoxPro expression without blowing up by wrapping the EVALUATE() operation into an internal TRY/CATCH block. o.SafeEval(lcEvalString,lvErrorResult) |
|
SetAcl |
Sets the Access Control List on a file resource by running the CACLS utility. o.SetAcl(lcPath,lcAccount,lcAccess,llInherit,llReplace) |
|
SetUrlEncodedKey |
Adds or updates a query string value for a given key with the provided value. o.SetUrlEncodedKey(lcQuery, lcKey, lcValue) |
|
ShortDate |
Creates a short date in the format of: Oct. 8 or Jun. 10. o.ShortDate(ltTime,lnMode) |
|
ShortPath |
Converts a Long Windows filename into a short 8.3 compliant path/filename. Use API so this is a valid 8.3 safe file path as recorded by the Operating System. o.ShortPath(lcPath) |
|
ShortTime |
Retuns a short time string that shows like 07:52am. o.ShortTime(ltTime) |
|
ShowHTML |
Displays an HTML string in the browser for quick viewing. o.ShowHTML(lcHTML, lcFile, loWebBrowser) |
|
ShowText |
Shows a text string and displays it in Notepad (or other configured editor) o.ShowText(lcHTML, lcFile, loWebBrowser) |
|
ShowXML |
Displays an XML string in a Web browser for quick viewing. o.ShowXML(lcXML, lcFile, loWebBrowser) |
|
StartsWith |
Checks to see if a base string starts with another string's characters. StartsWith(lcSourceString,lcCompare,llCaseInsensitive) |
|
StringFormat |
Function that replaces a format string with placeholder values passed as parameters using C-Style Format strings. This function is useful for quick embedding of strings that is more compact and efficient than using TEXTMERGE expressions on generating short text strings. o.StringFormat |
|
StripHTML |
Removes HTML tags from the passed text and converts it to plain text. Note formatting is totally removed! o.StripHTML(lcHTMLText, lcLTag, lcRTag) |
|
TimeToCStrict |
Creates a VFP strict date string that can be used in literal SQL strings. Simplifies creating dynamic SQL statements that are date safe. Optional pass the llSQL flag as .T. to have a SQL Server compatible date string returned. o.TimeToCStrict(ltTime, llSQL) |
|
ToIsoDateString |
Converts a FoxPro date or date time value to ISO 8601 format: 2012-10-08 16:55:12. ToIsoDateString(ldDate) |
|
TrimWhiteSpace |
Trims whitespace of the end of a string using a pre-set of characters that you optionally provide. By default CHR(13), CHR(10), Spaces and Tabs are cleared. o.TrimWhiteSpace(lcString,lcStripChars) |
|
URLDecode |
URLDecodes a URLEncoded text string to normal text. o.URLDecode(lcText) |
|
URLEncode |
Encodes a string in URL encoded format for use on URL strings or when creating a POST buffer. o.URLEncode(tcValue) |
|
WrCursor |
Creates a Writable cursor from a SELECTed cursor by creating a copy with a new name. o.WrCursor(pcNewName) |
Requirements
Assembly: wwUtils.prg© West Wind Technologies, 2004-2017 • Updated: 09/29/15
Comment or report problem with topic