why the hell did i write this FNKSHN?

why the hell did i write this FNKSHN?

Post by perry fect, republic » Tue, 14 Jan 1997 04:00:00



i can't for the life of me figure out why i wrote this FNKSHN!  what
problem does it fix?  i can't think of any.  i remember writing it because
i needed it but i can't figure out why?  it is used by other FNKSHNs and
apps that i've written so i won't get rid of it.  but i just don't know why
i wrote it.  STR() seems to work fine.  i think.

* FNKSHN 1.01
* FSTR(<number>)
*
* returns a floating point character value of <number>.
*
procedure fstr
parameters lnnum
private lnnum, lnint, lndec, lcdec, lcfstr
  if type("LNNUM")!="N"
    return ""
  endif
  lcfstr=alltrim(str(lnnum,237,18))
  lcdec=substr(lcfstr,at(".",lcfstr)+1)
  if val(lcdec)=0
    lcfstr=substr(lcfstr,1,at(".",lcfstr)-1)
  else
    do while right(lcfstr,1)="0"
      lcfstr=left(lcfstr,len(lcfstr)-1)
    enddo
  endif
return lcfstr

---------------------------------------------------------------------------
perry fect, president              Author of the *FREE* FNKSHN library for
UnderGround Milhouse Studios       FoxPro 2.x
PO Box 320411                      for more details, check the page below
Fairfield, CT 06432                          
http://w3.nai.net/~perfecto/fnkshn.html      

 
 
 

why the hell did i write this FNKSHN?

Post by Gene Wirchen » Tue, 14 Jan 1997 04:00:00



Quote:>i can't for the life of me figure out why i wrote this FNKSHN!  what

     Senility is sad.

Quote:>problem does it fix?  i can't think of any.  i remember writing it because
>i needed it but i can't figure out why?  it is used by other FNKSHNs and
>apps that i've written so i won't get rid of it.  but i just don't know why
>i wrote it.  STR() seems to work fine.  i think.

     No, it doesn't always.  Sometimes str() generates exponential
notation.  Your function appears to avoid this as best as possible
without the perfermance hit of assembling the string yourself.  That
is why the extreme parameters to str().

Quote:>* FNKSHN 1.01
>* FSTR(<number>)
>*
>* returns a floating point character value of <number>.
>*
>procedure fstr
>parameters lnnum
>private lnnum, lnint, lndec, lcdec, lcfstr
>  if type("LNNUM")!="N"
>    return ""
>  endif
>  lcfstr=alltrim(str(lnnum,237,18))
>  lcdec=substr(lcfstr,at(".",lcfstr)+1)
>  if val(lcdec)=0
>    lcfstr=substr(lcfstr,1,at(".",lcfstr)-1)
>  else
>    do while right(lcfstr,1)="0"
>      lcfstr=left(lcfstr,len(lcfstr)-1)
>    enddo

     The above, three lines could be replaced with:
          local ptr, looping
          ptr=len(lcfstr)
          looping=.t.
          while ptr>=1 and looping
             if substr(lcfstr,ptr,1)="0"
                ptr=ptr-1
             else
                looping=.f.
                endif
             enddo
          lcfstr=left(lcfstr,ptr)
This might run a bit faster due to only one string assignment being
done.  I haven't benchmarked it myself.

Quote:>  endif
>return lcfstr

Sincerely,

Gene Wirchenko

C Pronunciation Guide:
     y=x++;     "wye equals ex plus plus semicolon"
     x=x++;     "ex equals ex doublecross semicolon"

 
 
 

1. ANNOUNCE: FNKSHN 1.2.2/FNKSHN VISUAL COMPONENT SET

MAINTENANCE RELEASE OF FNKSHN 1.2 HAS BEEN UPDATED ON MY WEB SITE.

  Fixes:

    * BININT error
    * _CONTENTS filename shortened to _CONTENT

Also:

FNKSHN VISUAL COMPONENT SET IS ALMOST READ FOR RELEASE.

  Features:

    All (or most) Components:
      Dynamic Enable, Read-Only, and Visible settings
      Common method calls and syntax across components
      Utilitizes existing FNKSHN capabilities
      Hot Help property that displays as user moves from field to field
      ValueChanged events

    List Boxes/Combo Boxes:
      Read/Write from file
      Read/Write from FNKSHN InfoString
      Move/Copy Items from one list box to another
      Move/Copy Items to a field

    Edit Boxes:
      Move Text to a ListBox/ComboBox

    Memos:
      Read/Write from file

    New Components:
      Time/Date fields that utilitize FNKSHN Date/Time FNKSHNs
      File and Directory buttons

    AND MORE TO COME!!

--
FNKSHN 1.2 for FoxPro 2.x, 3.0, 5.0
ABSOLUTELY FREE SOFTWARE from electronic milhouse
http://w3.nai.net/~perfecto/fnkshn.html

2. Macro for making graphs????

3. Why am I doing a Table Scan?

4. tables and diagrams in the access ADP?

5. Why is the query doing this?

6. US-NY: New York-SQL Oracle

7. Why is sp doing a Table Scan?

8. SESSIONS ???

9. why is this doing this?

10. help figuring out why query doing full table scan

11. Why is IFMX stock doing poorly?

12. never done this NOW i know why I can't

13. Why is write-enable disabled?