<cfx_kmMisc> cfx_kmSuite
Programming Reference

cfx_kmMisc contains misc functions that didn't fit clearly into any other module.

Help
NumberWithSuffix
PathAddSlash
PathCombinePieces
PathDosToUnix
PathIsAbsolute
PathUnixToDos
RomanNumerals
Similarity
Soundex
StateAbbreviations
StateFromAbbrev
StateNames
StateToAbbrev
Version


F=NumberWithSuffix

Description
Determine the proper ordinal suffix for a number. For example, the suffix for 23 is "rd", for 24 is "th", etc.
Returns
The number with its suffix, e.g. 17th.
Syntax
  <cfx_kmMisc  F=NumberWithSuffix  V=variable  SHOW
      VALUE=number >
Attribute   Description         Required?
VALUE  Any number.  YES


Examples

<cfx_kmMisc F=NumberWithSuffix NUM=523>
Result:  523rd



F=PathAddSlash

Add a trailing slash to a path, if appropriate. If the path is a drive root or already ends with slash, no slash is added. The purpose of this is to prepare the path for appending a file name, etc.

Returns
Path with trailing slash.
Syntax
  <cfx_kmMisc  F=PathAddSlash  V=variable  SHOW
      PATH=file-path >
Attribute   Description         Required?
PATH  A path string.  YES


Examples

<cfx_kmMisc F=PathAddSlash PATH="c:">
<cfx_kmMisc F=PathAddSlash PATH="c:\pathname">
<cfx_kmMisc F=PathAddSlash PATH="c:\pathname\">
Result:  c:
c:\pathname\
c:\pathname\



F=PathCombinePieces

Combine two parts of a path into a single path, allowing for needed slashes, etc.

Returns
Combined path.
Syntax
  <cfx_kmMisc  F=PathCombinePieces  V=variable  SHOW
      PATH1=path-part1
      PATH2=file-part2 >
Attribute   Description         Required?
PATH1  The first path string.  YES
PATH2  The second path string.  YES


Examples

<cfx_kmMisc F=PathCombinePieces PATH1="c:\pathname"
    PATH2="filename.ext">
<cfx_kmMisc F=PathCombinePieces PATH1="c:"
    PATH2="pathname\filename.ext">
Result:  c:\pathname\filename.ext
c:pathname\filename.ext



F=PathDosToUnix

Convert a DOS path name to Unix format. Back slashes are converted to forward slashes.

Returns
Path name in Unix format.
Syntax
  <cfx_kmMisc  F=PathDosToUnix  V=variable  SHOW
      PATH=dos-path >
Attribute   Description         Required?
PATH  DOS path string.  YES


Examples

<cfx_kmMisc F=PathDosToUnix PATH="c:\pathname\filename.ext">
Result:  c:/pathname/filename.ext



F=PathIsAbsolute

Determine if a path reference is absolute or relative. Absolute paths refer to specific drive locations. Relative paths *could* exist within any directory on a drive.

For example, "c:\mypath\otherpath\file.ext" is absolute, as is "\mypath\otherpath\file.ext". The path "otherpath\file.ext" is relative.

Returns
Yes=Path is absolute No=Path is relative.
Syntax
  <cfx_kmMisc  F=PathIsAbsolute  V=variable  SHOW
      PATH=path >
Attribute   Description         Required?
PATH  A path string.  YES


Examples

<cfx_kmMisc F=PathIsAbsolute PATH="c:\pathname\filename.ext">
<cfx_kmMisc F=PathIsAbsolute PATH="pathname\filename.ext">
Result:  YES
NO



F=PathUnixToDos

Convert a Unix path name to DOS format. Forward slashes are converted to back slashes.

Returns
Path name in DOS format.
Syntax
  <cfx_kmMisc  F=PathUnixToDos  V=variable  SHOW
      PATH=unix-path >
Attribute   Description         Required?
PATH  Unix path string.  YES


Examples

<cfx_kmMisc F=PathUnixToDos PATH="c:/pathname/filename.ext">
Result:  c:\pathname\filename.ext



F=RomanNumerals

Convert a numeric value to Roman numerals.

Returns
Roman numerals.
Syntax
  <cfx_kmMisc  F=RomanNumerals  V=variable  SHOW
      VALUE=number >
Attribute   Description         Required?
VALUE  Any number.  YES


Examples

<cfx_kmMisc F=RomanNumerals VALUE=1997>
<cfx_kmMisc F=RomanNumerals VALUE=2000>
Result:  MCMXCVII
MM



F=Similarity

Compare two text strings and generate a similarity indicator value, from 0 to 100.

Returns
Numeric similarity value, from 0 to 100. 100 represents an absolute match. 0 indicates that there were no letters in common between the two values.
Syntax
  <cfx_kmMisc  F=Similarity  V=variable  SHOW
        VALUE1=text
        VALUE2=text >
Attribute   Description         Required?
VALUE1  Text string 1.  YES
VALUE2  Text string 2.  YES


Examples

<cfx_kmMisc F=Similarity VALUE1="Judson" VALUE2="Johnson">
<cfx_kmMisc F=Similarity VALUE1="Jonsen" VALUE2="Johnson">
Result:  62
77



F=Soundex

Compute the Soundex value of a text string.

Returns
Numeric Soundex value.
Syntax
  <cfx_kmMisc  F=Soundex  V=variable  SHOW
        VALUE=text >
Attribute   Description         Required?
VALUE  Any text value.  YES


Examples

<cfx_kmMisc F=Soundex VALUE="Judson">
<cfx_kmMisc F=Soundex VALUE="Jonsen">
<cfx_kmMisc F=Soundex VALUE="Johnson">
Result:  892482378
892482890
892482890



F=StateAbbreviations

Return a sorted list of state abbreviations, including DC.

Returns
List of state abbreviations.
Syntax
  <cfx_kmMisc  F=StateAbbreviations  V=variable  SHOW >
Attribute   Description         Required?
no additional attributes


F=StateFromAbbrev

Given a standard, 2 character state abbreviation, lookup the full state name.

Returns
State name.
Syntax
  <cfx_kmMisc  F=StateFromAbbrev  V=variable  SHOW
        VALUE=text >
Attribute   Description         Required?
VALUE  State abbreviation.  YES


Examples

<cfx_kmMisc F=StateFromAbbrev VALUE="ND">
<cfx_kmMisc F=StateFromAbbrev VALUE="VI">
<cfx_kmMisc F=StateFromAbbrev VALUE="DC">
Result:  North Dakota
Virgin Islands
District of Columbia



F=StateNames

Return a sorted list of state names, including District of Columbia.

Returns
List of state names.
Syntax
  <cfx_kmMisc  F=StateNames  V=variable  SHOW >
Attribute   Description         Required?
no additional attributes


F=StateToAbbrev

Given the name of a state, return the standard, 2 char state abbreviation. If the state name is misspelled, this routine makes a best guess attempt.

Returns
State abbreviation.
Syntax
  <cfx_kmMisc  F=StateToAbbrev  V=variable  SHOW
        VALUE=state-name >
Attribute   Description         Required?
VALUE  Desired state name. If state is misspelled, a "guess" is made.  YES


Examples

<cfx_kmMisc F=StateToAbbrev VALUE="Minnasoda">
Result:  MN

<cfx_kmMisc F=StateToAbbrev VALUE="dullawhere">
<cfx_kmMisc F=StateToAbbrev VALUE="dellawhere">
<cfx_kmMisc F=StateToAbbrev VALUE="delewere">
Result:  ??
??
DE