Login | |
|
 |
VBScript functionality - 10/29/2005 6:20:39 PM
|
|
 |
|
| |
TNO
Posts: 1064
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
This may be a little blasphemous in a vbscript forum but here it goes: Here is a compilation/creation/collection of recreated vbscript functions for use in JavaScript. This will be helpful to those (like myself). Who try to use the best of both worlds in their projects. This will also help those unfamiliar with the language to simplify some more complex problems. Here's a quick overview of the contents: CreateObject(x) Translates into: new ActiveXObject(x) dateDiff(p_Interval, p_Date1, p_Date2,p_firstdayofweek, p_firstweekofyear) Returns the number of intervals between two dates datePart(p_Interval, p_Date,p_firstdayofweek, p_firstweekofyear) Returns the specified part of a given date. FormatCurrency(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits) FormatDateTime(datetime, FormatType) FormatNumber(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits) FormatPercent(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits) InStr(strSearch,charSearchFor) Returns the first location a substring SearchForStr that was found in the string str isDate(p_Expression) Left(string, length) Returns a specified number of characters from the left side of a string. Len(str) Returns the number of characters in a string. LTrim(str) Returns a copy of a string without leading spaces. Mid(str,start,len) Returns a specified number of characters from a string. monthName(p_Date, p_abbreviate) Now() Returns the current date and time. Right(string, length) Returns a specified number of characters from the right side of a string RTrim(string) Returns a copy of a string without trailing spaces. StrReverse(strInput) Returns the reverse of a string. Trim(strInput) Removes leading and trailing spaces weekdayName(p_Date, p_abbreviate) <Updated library below>
< Message edited by TNO -- 10/18/2006 10:02:24 PM >
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: VBScript functionality - 10/18/2006 9:58:06 PM
|
|
 |
|
| |
TNO
Posts: 1064
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
I almost forgot about my ancient post here. Figured its time for an update of some sort: //version: 1.01 updates in red CreateObject(x) Translates into: new ActiveXObject(x) dateAdd(p_Interval, p_Number, p_Date) <--Supports Milliseconds!!! dateDiff(p_Interval, p_Date1, p_Date2,p_firstdayofweek, p_firstweekofyear) <--Supports Milliseconds!!! Returns the number of intervals between two dates datePart(p_Interval, p_Date,p_firstdayofweek, p_firstweekofyear) Returns the specified part of a given date. FormatCurrency(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits) FormatDateTime(datetime, FormatType) FormatNumber(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits) FormatPercent(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits) InStr(strSearch,charSearchFor) Returns the first location a substring SearchForStr that was found in the string str isDate(p_Expression) Left(string, length) Returns a specified number of characters from the left side of a string. Len(str) Returns the number of characters in a string. LTrim(str) Returns a copy of a string without leading spaces. Mid(str,start,len) Returns a specified number of characters from a string. monthName(p_Date, p_abbreviate) monthName(p_Date, p_abbreviate) Now() Returns the current date and time. Right(string, length) Returns a specified number of characters from the right side of a string RTrim(string) Returns a copy of a string without trailing spaces. StrReverse(strInput) Returns the reverse of a string. Trim(strInput) Removes leading and trailing spaces weekdayName(p_Date, p_abbreviate) If there is functionality you'd like to see added to this library let me know!
Attachment (1)
< Message edited by TNO -- 10/18/2006 10:00:21 PM >
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|