SP_EDITMEMOV

EDITMEMOV()

  Short:
  ------
  EDITMEMOV() Performs a windowed memoedit() on a string

  Returns:
  --------
  <cBuffer> => changed string

  Syntax:
  -------
  EDITMEMO(cBuffer,[nTop,nLeft,nBottom,nRight],[lModify],;
            [nLineLength],[cTitle])

  Description:
  ------------
  Pops up a box allowing memo editing of a string.
  Edits string <cBuffer>. Options for import and export as well.

  Escape exits, F10 saves [cBuffer]. Uses coordinates
  2,10,20,69 unless passed coordinates as
  [nTop,nLeft,nBottom,nRight]

  [lModify] - True = allow edit (default), False = view
  only

  [nLineLength] - line length - default is window
  width-1

  [cTitle]  Title (max 25 characters) Default is MEMO PAD (new to 3.5)

  Examples:
  ---------
   cNew := editmemov("Good golly miss molly!")
   cNew := editmemov(memoread("DOCS.DOC"),2,2,22,78)
   cNew := editmemov(memoread("DOCS.DOC"),2,2,22,78,.f.)

  Notes:
  -------
  If editing, must have a box width of at least 50.
  Unlike EDITMEMO, this works on a memvar and returns a memvar.

  Source:
  -------
  S_EDITM.PRG

 

SP_CRUNCH

CRUNCH()

  Short:
  ------
  CRUNCH() Moves spaces in a string to end of string

  Returns:
  --------
  <cCrunched> string with spaces moved to end

  Syntax:
  -------
  CRUNCH(cOriginal,nAllor1)

  Description:
  ------------
  Moves spaces to end of string <cOriginal>. If
  <nAllor1> = 1, moves all but single spaces to right end of the
  string. If <nAllor1> = 0 moves all spaces to the right end.

  Examples:
  ---------

  cString := "SUPER    Library version 2.50"

  cString := CRUNCH(cString,1) // "SUPER Library version 2.50  "

  cString := CRUNCH(cString,0) // "SUPERLibraryversion2.50     "

  Notes:
  -------
  Handy for names (i.e. FIRST and LAST)

  Source:
  -------
  S_CRUNCH.PRG

 

SP_BIGELEM

BIGELEM()

  Short:
  ------
  BIGELEM() Returns length of longest string in an array

  Returns:
  --------
  <nLength> => Length of longest string in an array

  Syntax:
  -------
  BIGELEM(aTarget)

  Description:
  ------------
  Determines the length of the longest string element
  in <aTarget> Array may have mixed types

  Examples:
  ---------
   ?BIGELEM(  {"1","22","333"}  )  => returns 3

  Notes:
  -------
  This was a C function in previous SuperLibs

  Source:
  -------
  S_BIGEL.PRG

 

SP_ATT

ATT()

  Short:
  ------
  ATT() Colors a section of the screen, leaving the text intact

  Returns:
  --------
  <cUnder> => Underlying screen before change

  Syntax:
  -------
  Att(nTop,nLeft,nBottom,nRight,nColorAttribute)

  Description:
  ------------
  <nTop>             - top row
  <nLeft>            - left col
  <nBottom>          - bottom row
  <nRight>           - right column
  <nColorAttribute>  - attribute to set area  (numeric color )

  Saves and returns the underlying screen at <ntop,nLeft,nBottom,nRight>

  Examples:
  ---------
   ATT(5,5,10,10,79)   // sets 5,5,10,10 to +W/R

  Notes:
  ------
  This was a C file previously

  Source:
  -------
  S_ATT.PRG

 

SP_AT2CHAR

AT2CHAR()

  Short:
  ------
  AT2CHAR() Returns the String color equivalent of a color number

  Returns:
  --------
  <cColorString> => Color string

  Syntax:
  -------
  AT2CHAR(nColorAttribute)

  Description:
  ------------
  <nColorAttribute> the numeric color to be converted,
  is changed to <cColorString>, a clipper color string.

  Examples:
  ---------
   AT2CHAR(47)  // =>  "W/G"

  Source:
  -------
  S_AT2C.PRG

 

SP_ARRANGE

ARRANGE()

  Short:
  ------
  ARRANGE() Rearranges text in a string

  Returns:
  --------
  <cNewString> => String rearranged

  Syntax:
  -------
  ARRANGE(cInString,nStart,nLength,nNewPosit)

  Description:
  ------------
  Extracts text from <cInString> starting at <nStart>
  for a length of <nLength> and moves it to position
  <nNewPosition>.

  Examples:
  ---------
   cString := "SUPERFUNCTION"
   cString := ARRANGE(cString,6,8,1)
    // =>  "FUNCTIONSUPER"

  Notes:
  ------
  New position is position AFTER text is cut from
  original position

  Source:
  -------
  S_ARRANG.PRG

 

FT_AT2

FT_AT2()
 Find position of the nth occurrence of a substring

 Syntax

      FT_AT2( <cSearch>, <cTarget> [, <nOccurs> [, <lCaseSens> ] ] ) -> nPos

 Arguments

     <cSearch> is the character substring to search for.

     <cTarget> is the character string to search.

     <nOccurs> is the occurrence of cSearch to look for,
                defaults to 1.

     <lCaseSens> is a logical value denoting case sensitivity.
                If .F., then search is NOT sensitive to case,
                defaults to .T.

 Returns

     The position of the nth occurrence of a substring

 Description

     This function will find the nth occurrence of a substring
     within a string.

 Examples

     cSearch := "t"
     cTarget := "This is the day that the Lord has made."

     FT_AT2( cSearch, cTarget )            // Returns ( 9 )

     FT_AT2( cSearch, cTarget, 2 )         // Returns ( 17 )

     FT_AT2( cSearch, cTarget, 2, .F. )    // Returns ( 9 )

 Source: AT2.PRG

 Author: Ralph Oliver,  TRANSCOM SYSTEMS

See Also: FT_FINDITH()



 

FT_UNSQZN

FT_UNSQZN()
 Uncompress a numeric compressed by FT_SQZN()
------------------------------------------------------------------------------

 Syntax

      FT_UNSQZN( <cCompressed>, <nSize> [, <nDecimals> ] ) -> nValue

 Arguments

     <cCompressed>  - Compressed string, obtained from FT_SQZN()

     <nSize>        - Size of numeric field

     <nDecimals>    - Optional number of decimal places

 Returns

     nValue       - Uncompressed numeric value

 Description

    The FT_UNSQZN function returns the numeric value from the compressed
    string.  The compression is 50% the storage space of the original
    number.  The original number must have been compressed using the
    FT_SQZN() function.

    This function, along with FT_SQZN() can be used to reduce disk storage
    requirements for numeric fields in a database file.

 Examples

    mcust_id := FT_UNSQZN(TRANS->cust_id,8),;
    mamount  := FT_UNSQZN(TRANS->amount,12,2)

 Source: SQZN.PRG

 Author: Joseph D. Booth, Sr.

See Also: FT_SQZN()

FT_SQZN

FT_SQZN()
 Compress a numeric value into a character string

 Syntax

      FT_SQZN( <nValue> [, <nSize> [, <nDecimals> ] ] ) -> cCompressed

 Arguments

     nValue       - The numeric value to be compressed
     nSize        - Optional size of numeric field, defaults to 10
     nDecimals    - Optional number of decimal places, defaults to 0

 Returns

     cCompressed  - Compressed string, 50% the size of nSize

 Description

    The FT_SQZN function allows a numeric value to be compressed when
    stored in the database.  The compression is 50% the storage space
    of the original number.  The companion function, FT_UNSQZN returns
    the original number from the compressed string.

 Examples

  replace TRANS->cust_id with FT_SQZN(mcust_id,8),;
          TRANS->amount  with FT_SQZN(mamount,12,2)

 Source: SQZN.PRG

 Author: Joseph D. Booth, Sr.

See Also: FT_UNSQZN



FT_NTOW

FT_NTOW()
 Translate numeric value to words

 Syntax

      FT_NTOW( <nNumber> ) -> cWords

 Arguments

     <nNumber>  An integer to translate

 Returns

     A text string representing <nNumber>

 Description

      Translates numeric input to a text string.

      FT_NTOW is intended to be used with integers only.  Since I don't
      know what your application will be, I can't assume the type of
      fraction you want returned (ninety nine cents, 99/100, .99, etc).
      If you want the fraction in words, just pass it as an integer.

      Do not pass a negative number!  Handle negative numbers any way
      you need to in your code.  (ie: CR, DB, Negative, Minus, etc.)

      Also, numeric 0 is returned as a null string.  You will need to
      make a decision how to output it (zero dollars, no dollars, etc).

 Examples

                ? FT_NTOW( 999 )                -> Nine Hundred Ninety Nine

                ? FT_NTOW( 1000 )               -> One Thousand

                ? FT_NTOW( 23 ) + " Dollars and " + FT_NTOW( 99 ) + " Cents"
                        -> Twenty Three Dollars and Ninety Nine Cents

                ? FT_NTOW( 23 ) + " Dollars and " + "99/100"
                        -> Twenty Three Dollars and 99/100

    x      := -23.99
    cents  := str( (x - int( x )) * 100, 2, 0 ) + "/100"
                x      := int( x )
    string := iif( x < 0, "Credit of ", "Debit of " )
                ? string + FT_NTOW( abs(x) ) + " Dollars and " + "99/100"
                     -> Credit of Twenty Three Dollars and 99/100

 Source: NTOW.PRG

 Author: Gary Baren