home *** CD-ROM | disk | FTP | other *** search
- '******************************* MYFUNCS.MST *********************************
- 'Demonstrates: This file is a small library of custom-built functions. To use
- ' these functions, the calling script must include the MYOWN.INC
- ' file.
- '
- 'Required Files: MYOWN.INC
- '
- 'Uses:
- '
- 'Complexity Level: INTERMEDIATE
- '
- 'Notes: This file should be placed in your MSTest INCLUDE subdirectory. To add
- ' your own custom-built function or subroutine, define your function/sub'
- ' in this file and don't forget to declare it in MYOWN.INC.
- '
- '******************************************************************************
-
-
- '**********************************************************************
- ' FUNCTION BraceSpecCHR$
- 'This function encloses in braces 4 special characters, the left/right
- 'parenthesis, tilde, and percent symbol. By enclosing these
- 'chars in braces DoKeys & QueKeys are able to display these symbols.
- '
- 'returns: string with braces around special chars.
- '
- 'usage: temp$ = BraceSpecCHR(str$)
- '**********************************************************************
-
- FUNCTION BraceSpecCHR$(strexp$) STATIC
- n% = LEN(strexp$)
- temp$ = ""
-
- FOR i = 1 to n
- index$ = mid$(strexp$,i,1)
- IF (index$="(") OR (index$=")") OR (index$="%") OR (index$="~") THEN
- temp$ = temp$ + "{" + index$ + "}"
- ELSE
- temp$ = temp$ + index$
- END IF
- NEXT i
- BraceSpecCHR = temp$
- END FUNCTION
-
-
- '**********************************************************************
- 'FUNCTION LeftString
- 'Takes the first size% characters starting from the left-most char
- 'from a given string, strexp$.
- '
- 'returns: left-most size% characters.
- '
- 'usage: temp$ = LeftString(str$,n%)
- '**********************************************************************
-
- FUNCTION LeftString$(strexp$,size%) STATIC
- n% = LEN(strexp$)
- IF (size% <= n%) AND (size% >= 0) THEN
- LeftString = mid$(strexp$,1,size%)
- ELSE
- LeftString = strexp$
- END IF
- END FUNCTION
-
-
- '**********************************************************************
- 'FUNCTION RightString
- 'Takes size% right-most characters from a given string, strexp$.
- '
- 'returns: right-most size% characters.
- '
- 'usage: temp$ = RightString(str$,n%)
- '**********************************************************************
-
- FUNCTION RightString$(strexp$,size%) STATIC
- n% = LEN(strexp$)
- IF (size% <= n%) AND (size% >= 0) THEN
- diff% = n% - size% + 1
- RightString = mid$(strexp$,diff%,size%) 'size% not necessary here
- ELSE 'put in for consistency.
- RightString = strexp$
- END IF
- END FUNCTION
-
-