Loading ...
Sorry, an error occurred while loading the content.

IsCapitalized and other Is Functions

Expand Messages
  • Wayne VanWeerthuizen
    I am still working on the NoteTab Reference Outline, and still finding more questions to ask about the fine details of NoteTab Clip Language. One item that
    Message 1 of 3 , Dec 31, 2000
    • 0 Attachment
      I am still working on the NoteTab Reference Outline, and still finding
      more questions to ask about the fine details of NoteTab Clip Language.

      One item that caught my attention is surprising behavior for the
      ^$IsCapitalized()$ function with non-alphabetic characters.

      ^$IsCapitalized("12345")$ = 1 but ^$IsCapitalized("-1234")$ = 0
      and ^$IsCapitalized("!@#$%")$ = 0

      Also ^$IsMixedCase()$ doesn't act as I expected:

      ^$IsMixedCase("Aa_Bb")$ = 1 but ^$IsMixedCase("M80sx")$ = 0
      and ^$IsMixedCase("12345")$ = 1

      Is there a concise explanation of what is happening here?
      Are some nonalphabetic characters treated differently than others?
      Is 12.34 a number?
      BTW, I am happy to see that accented characters are handled properly.


      Here is a table of the tests I performed on various of the
      ^$Is___()$ functions with NoteTab Pro 4.83.
      The last string tested was empty.

      (Table is meant to be views with a fixed width font.)

      UPPER lower Cap MiXeD Aa_Bb A B C a b c
      IsAlpha 1 1 1 1 0 0 0
      IsAlphaNumeric 1 1 1 1 0 0 0
      IsNumber 0 0 0 0 0 0 0
      IsHex 0 0 0 0 0 0 0
      IsUppercase 1 0 0 0 0 1 0
      IsLowercase 0 1 0 0 0 0 1
      IsCapitalized 0 0 1 0 0 0 0
      IsMixedCase 0 0 0 1 1 0 0


      MI2L8 !@#$% âéïôû ÄÉÖÜ ají Ñandú ÑaQue
      IsAlpha 0 0 1 1 1 1 1
      IsAlphaNumeric 1 0 1 1 1 1 1
      IsNumber 0 0 0 0 0 0 0
      IsHex 0 0 0 0 0 0 0
      IsUppercase 1 1 0 1 0 0 0
      IsLowercase 0 1 1 0 1 0 0
      IsCapitalized 0 0 0 0 0 1 0
      IsMixedCase 0 1 0 0 0 0 1


      12345 -1234 12.34 1.2e4 -23E5 M80sx
      IsAlpha 0 0 0 0 0 0 0
      IsAlphaNumeric 1 0 0 0 0 1 0
      IsNumber 1 1 0 0 0 0 0
      IsHex 1 0 0 0 0 0 0
      IsUppercase 1 1 1 0 1 0 1
      IsLowercase 1 1 1 1 0 0 1
      IsCapitalized 1 0 1 1 0 1 0
      IsMixedCase 1 1 1 1 1 0 0






      For anyone interested, here is the clip used to generate the above table:

      H="Test IsCase functions"
      ; Assumes target document has Real Tabs every 8 columns.
      ^!SetPasteIndent 0
      ^!SetArray %Data1x%="UPPER";"lower";"Cap";"MiXeD";"Aa_Bb";"A B C";"a b c"
      ^!SetArray %Data2x%="MI2L8";"!@#$%";"âéïôû";"ÄÉÖÜ";"ají";"Ñandú";"ÑaQue"
      ^!SetArray %Data3x%="12345";"-1234";"12.34";"1.2e4";"-23E5";"M80sx";""
      ^!Set %DataLine%=0
      :NextData
      ^!Inc %DataLine%
      ^!If ^%DataLine% > 3 END
      :Headings
      ^!InsertText ^P^P^P^$StrFill(" ";16)$
      ^!Set %Count%=0
      :HeadingsLoop
      ^!Inc %Count%
      ^!If ^%Count% > ^%Data^%DataLine%x0% HeadingsDone
      ^!InsertText ^%Data^%DataLine%x^%Count%%^T
      ^!Goto HeadingsLoop
      :HeadingsDone
      ^!InsertText ^P
      ^!Set %IsAlphaRow%=^$GetRow$
      ^!InsertText IsAlpha
      ^!InsertText ^P IsAlphaNumeric
      ^!InsertText ^P IsNumber
      ^!InsertText ^P IsHex
      ^!InsertText ^P IsUppercase
      ^!InsertText ^P IsLowercase
      ^!InsertText ^P IsCapitalized
      ^!InsertText ^P IsMixedCase
      ^!InsertText ^P
      ^!Set %Count%=0
      :Loop
      ^!Inc %Count%
      ^!If ^%Count% > ^%Data^%DataLine%x0% NextData
      ^!Jump ^%IsAlphaRow%
      ^!Jump Line_End
      ^!InsertText ^$IsAlpha("^%Data^%DataLine%x^%Count%%")$^T
      ^!Jump +1
      ^!Jump Line_End
      ^!InsertText ^$IsAlphaNumeric("^%Data^%DataLine%x^%Count%%")$^T
      ^!Jump +1
      ^!Jump Line_End
      ^!InsertText ^$IsNumber("^%Data^%DataLine%x^%Count%%")$^T
      ^!Jump +1
      ^!Jump Line_End
      ^!InsertText ^$IsHex("^%Data^%DataLine%x^%Count%%")$^T
      ^!Jump +1
      ^!Jump Line_End
      ^!InsertText ^$IsUppercase("^%Data^%DataLine%x^%Count%%")$^T
      ^!Jump +1
      ^!Jump Line_End
      ^!InsertText ^$IsLowercase("^%Data^%DataLine%x^%Count%%")$^T
      ^!Jump +1
      ^!Jump Line_End
      ^!InsertText ^$IsCapitalized("^%Data^%DataLine%x^%Count%%")$^T
      ^!Jump +1
      ^!Jump Line_End
      ^!InsertText ^$IsMixedCase("^%Data^%DataLine%x^%Count%%")$^T
      ^!Goto Loop

      --
      Wayne M. VanWeerthuizen
      Homepage: http://landru.myhome.net/wayne
    • Jody
      Hi Wayne and Eric, ... Eric ought to answer, but I could not resist. In beta 4.8 #17, Eric wrote: * Fixed ^$IsCapitalized(1234)$ ... ^$IsMixedCase( Aa_Bb )$ =
      Message 2 of 3 , Dec 31, 2000
      • 0 Attachment
        Hi Wayne and Eric,

        >One item that caught my attention is surprising behavior for the
        >^$IsCapitalized()$ function with non-alphabetic characters.
        >
        > ^$IsCapitalized("12345")$ = 1 but ^$IsCapitalized("-1234")$ = 0
        > and ^$IsCapitalized("!@#$%")$ = 0

        Eric ought to answer, but I could not resist.
        In beta 4.8 #17, Eric wrote: * Fixed ^$IsCapitalized(1234)$

        >Also ^$IsMixedCase()$ doesn't act as I expected:
        >
        > ^$IsMixedCase("Aa_Bb")$ = 1 but ^$IsMixedCase("M80sx")$ = 0
        > and ^$IsMixedCase("12345")$ = 1

        From sometime in the past I wrote:
        >>^!Info ^$IsMixedCase("If")$^p^$IsMixedCase("iF")$^p^$IsMixedCase("tEst")$

        Eric replied:
        > ...The idea of this function is to be
        > able to test words that do not have normal case arrangements.
        > Perhaps my logic is twisted and this is a bad idea?

        ^$IsMixedCase("Aa_Bb")$ = 1 Correct.
        ^$IsMixedCase("M80sx")$ = 0 It must see that as a word that is cap'd.
        ^$IsMixedCase("12345")$ = 1 Seems numbers turn up one when cases are
        looked for.

        Sort of backwards of from IsCap.
        ^!Info ^$IsMixedCase("If")$^p^$IsMixedCase("iF")$^p^$IsMixedCase("tEst")$^p^p^$IsCapitalized("If")$^p^$IsCapitalized("iF")$^p^$IsCapitalized("tEst")$

        >Is there a concise explanation of what is happening here?
        >Are some nonalphabetic characters treated differently than others?
        >Is 12.34 a number?

        The period is a mixed case according to the functions. (Just adding more info.
        ^!Info ^$IsMixedCase("12.34")$^p^$IsNumber("12.34")$^p^$IsAlphaNumeric("12.34")$^p^$IsAlpha("12.34")$^p^p^$IsMixedCase(".")$^p^$IsAlpha(".")$

        >BTW, I am happy to see that accented characters are handled properly.
        >
        >
        >Here is a table

        Nice. :)


        Happy Clip'n!
        Jody

        http://www.notetab.net

        Subscribe, UnSubscribe, Options
        mailto:Ntb-Clips-Subscribe@...
        mailto:Ntb-Clips-UnSubscribe@...
        http://www.egroups.com/group/ntb-clips
      • Eric G.V. Fookes
        Hello Wayne, ... I treat numbers as being both lower and uppercase, so that they don t interfere in the result when numbers are mixed with words. The - is
        Message 3 of 3 , Jan 2, 2001
        • 0 Attachment
          Hello Wayne,

          >One item that caught my attention is surprising behavior for the
          >^$IsCapitalized()$ function with non-alphabetic characters.
          >
          > ^$IsCapitalized("12345")$ = 1 but ^$IsCapitalized("-1234")$ = 0
          > and ^$IsCapitalized("!@#$%")$ = 0

          I treat numbers as being both lower and uppercase, so that they don't
          interfere in the result when numbers are mixed with words. The "-" is not
          considered a number and thus does not have this special property.

          >Also ^$IsMixedCase()$ doesn't act as I expected:
          >
          > ^$IsMixedCase("Aa_Bb")$ = 1 but ^$IsMixedCase("M80sx")$ = 0
          > and ^$IsMixedCase("12345")$ = 1

          If only the first character is in upper case, then it is not considered
          "mixed case". The Help file says: "Note that text that is capitalized is
          not considered mixed case."

          Hope this clears some of the mystery. I do realize that my approach will
          not necessarily suit everyone.


          Regards,
          Eric G.V. Fookes
          Author of NoteTab, Mailbag Assistant, and Album Express
          http://www.fookes.com/ and http://www.notetab.com/







          ...
        Your message has been successfully submitted and would be delivered to recipients shortly.