Newton Logo
Newton Does It!


What's new?
Site Map
Meta-FAQ
1 | 2 | 3 | 4
Tech-Infos
Communication
Software
1
 | 2 | 3
Astronomy
1 | 2 | 3
QF Works/Pro Tips
Tests / Reviews
Hardware DIY
News & eZines
The Newton Story
=- Site Archive -=
Div. / Misc. Links
Homepage

03.10.2003

QuickFigure Works/Pro
"Secret" Functions

Diese Seite können Sie auch auf deutsch lesen!

PelicanWare's QuickFigure Pro (QF Pro) and its little brother QuickFigure Works (free download of the latest version QF Works 1.1.2) that comes with every MP 2x00 offer a lot of mathematical, financial, statistical and time & date functions:
But there are some more undocumented functions and tricks:

String Functions


All function are explained in the manual and in the online help. The only functions that are missing, are text manipulating functions. But you can use NewtonScript functions instead.

Here are some useful functions for working with strings.

  • Strings are enclosed in quotation marks "Hello World"
  • Strings are separated by commas "Hello","World"

    The functions are case insensitive, capital letters are only used for easier reading. Changes are hilited in the result.
    Function/Example Description/Result
    Capitalize capitalizes the first letter of a string
    Capitalize("hello world") Hello world
    CapitalizeWords capitalizes the first letter of each word
    CapitalizeWords("hello word") "Hello World"
    UpCase capitalizes whole string
    UpCase("hello world") "HELLO WORLD"
    DownCase converts whole string to lower case
    DownCase("HELLO WORLD") "hello world"
    StringToNumber converts a string to a number (for calculations)
    StringToNumber("0815") 815
    NumberStr converts a number to a string
    NumberStr(800+15) "815"
    StrLen length of string
    StrLen("Hello World") 11
    BeginsWith compares the beginning of two strings
    BeginsWith("Hello World","Hel") True (boolean value for IF ... THEN ... ELSE)
    EndWith compares the end of two strings
    EndWith("Hello World","ord") False (boolean value for IF ... THEN ... ELSE)
    & joins two strings
    "Hello" & "World" "HelloWorld"
    && joins to strings with one space
    "Hello"&&"World" "Hello World"
    SubStr extracts a part of a string (string,start,count)
    SubStr("Hello World",2,3) "llo"
    StrPos finds a string in an other (string,substring,start)
    StrPos("Hello World","or", 0) 7
    Chr displays the ASCII character with this code
    Chr(78) "N"


    How to check for empty cells

    Using the NewtonScript string functions in QF Works/Pro only returns a VALUE! error if an addressed cell is empty. As you cannot use a simple string compare (= if a2 = "" then "empty") to check if a cell is empty, you have to use a little trick instead. This trick forces QF Works/Pro to convert a cell's content to a string, even if the cell is empty.
    Cell A1 : Enter your name:
    Cell A2 :
    Cell A3 : =IF STRLEN(A2 & "") = 0
                  THEN "Cell A2 is emtpy"
                  ELSE "The name is " & A2
    


    Using NewtonScript in QF

    You can also execute other NewtonScript functions directly in QF Works/Pro. If you have MacinTalk installed you can try this little example:

    Cell A1 : account
    Cell A2 : 500
    Cell A3 : = IF A2 <= 0
                THEN PLAYSOUND("Sorry, no money left!")
                ELSE PLAYSOUND(NumberStr(A2))
    

    If you put zero or a negative number in A2 QF Works/Pro will warn you about your financial situation :-)


    How to activate the hidden NOS games

    To activate the secret easter eggs hidden in the NOS just enter in a QF cell:
    for Poker    : =buildContext(@830):open()
    
    or
    
    for Patience : =buildContext(@831):open()
    


    What cannot be done in QuickFigure


    You can use first level data in formulas. E.g.
    Cell A1 : = GetUserConfig('name)
    

    gives back the user name

    But there is no way to retrieve second level data, like the GMT offset.
    Don Vollum from PelicanWare has confirmed this "feature" and will try to fix it in the next version of QF Pro (if there will be any).

    QuickFigure also has some problems with nested function calls. When I tried to analyze the server log of my web site I noticed the following problem: :
    The cells A1 to A50 contain the handled file requests sorted by the number of requests. The format is "number of requests : transferred kb : file name".

    Cell A1 : 123 : 34 : <index.html>
    Cell A2 : 143 : 45 : <something.html>
    etc.

    To sort this list alphabetically column A must be separated in requests, transferred KB and file name.
    Separating the file name in three steps :

    Cell B1 : "= StrPos(a1,"<",0)"
    Cell C1 : "= StrPos(a1,">",0")"
    Cell D1 : "= SubStr(a1,b1+1,c1-b1-1)"
    

    returns "index.html" in cell D1.

    But trying to combine all three steps in just one cell

    cell B1 : "= SubStr(a1,StrPos(a1,"<",0)+1,
                StrPos(a1,">",0")-StrPos(a1,"<",0)-1)"
    

    only returns a "VALUE!" error.


    Y2K bug in stringToDate

    From: donv@teleport.com (Don Vollum)
    Newsgroups: comp.sys.newton.programmer
    Subject: Y2K bug in stringToDate
    Message-ID: <donv-1301001356020001@200.200.200.2>
    Date: Thu, 13 Jan 2000 13:55:47 -0800

    This is probably old news, but I've been getting some Y2K bug reports on some of my software, and lo and behold, stringToDate has what I would describe as a bug (I'm sure if Newton DTS were still around, they would explain to me how this is a feature, it's supposed to be this way, whatever...).

    Anyway, here goes:

    stringToDate("7/21/99")
    #1885A334 102852813

    stringToDate("7/21/1999")
    #BFB6EB4 50256813

    stringToDate("7/21/2099")
    #1885A340 102852816

    Essentially, it's interpreting any date in mm/dd/yy format as "20yy".

    More information about the Y2K bug can be found at : PelicanWare Y2K

    [Oben / Top]

    Andree Dettmer 03.10.2003