Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • index is the old strpos?

    I just came across some Stata code that used the function index(). I tried using it, and it seems to work like strpos(). Is it the old name for the same function, or are there differences?

    Typing
    help index() in Stata redirects you to help f_strpos, but the entry actually makes no mention of the function.

  • #2
    Indeed. Same thing.

    Comment


    • #3
      I see, thanks!

      Comment


      • #4
        You use it in groups.ado (available from SSC). Would using strpos() have made the code break in Stata 8?

        Comment


        • #5
          Quite possibly.

          Comment


          • #6
            Also, see

            Code:
            help whatsnew8to9

            Comment


            • #7
              Thanks, Daniel! It helps to understand why these changes were made!

              For others, so they get the answer right here, here is the relevant excerpt from the entry referenced in #6:

              Code:
                   4. The following existing functions have been renamed:
              
                              old name                new name
                              --------------------------------------
                              index()                 strpos()
                              binorm()                binormal()
                              match()                 strmatch()
                              norm()                  normal()
                              invnorm()               invnormal()
                              normd()                 normalden()
                              lnfact()                lnfactorial()
                              issym()                 issymmetric()
                              syminv()                invsym()
                              --------------------------------------
              
                      Old names continue to work.  Functions were renamed because the new name is better and because Mata uses the new name, and you want to
                      be able to use the same names in both environments.

              Comment


              • #8
                daniel klein 's pointer puts precision on the query. If the code were changed to strpos() and you tried to run the command in Stata 8, it would fail because declaring version 8 doesn't translate later syntax, here from version 9, into version 8 syntax. Conversely, the code would run fine, so far as I know. in Stata 9 up, if you changed the function. If anyone changes the code, it is their version of my command.

                What version implies is hard to explain, but there is an attempt at https://www.stata.com/support/faqs/p...stata-version/

                A negative summary that is either intriguing or infuriating is that version is not a time machine.
                Last edited by Nick Cox; 07 Nov 2022, 06:37.

                Comment

                Working...
                X