3 Replies Latest reply on Apr 14, 2007 9:23 AM by Newsgroup_User

    charPos from word[x].char[x]  ?

    Level 7
      Hi there experts,

      Anyone know an easy way that I can derive a charPos from a given character
      of a given word in a text member? Something like this fictional code...


      member("TextMember","TextCast").text = "One Two Three"
      put member("TextMember","TextCast").word[3].char[1].charPos
      --9


      I obviously made that syntax up to show my point, but I can't use offSet()
      as there may be previous instances of the word I'm trying to find the
      character pos for in the text member's string.

      I could probably create a sub string from (member.word[1..2]).char.count +1,
      but I wondered if there was a cleaner way to do it.

      Thanks Lingoers! :)

      Richard Smith


        • 1. Re: charPos from word[x].char[x]  ?
          Chunick Level 3
          you can use the range...

          put member("TextMember","TextCast").word[3].range

          and go from there....
          • 2. Re: charPos from word[x].char[x]  ?
            Chunick Level 3
            ... however, I now just read this part:
            "I obviously made that syntax up to show my point, but I can't use offSet()
            as there may be previous instances of the word I'm trying to find the
            character pos for in the text member's string."

            which suggests that you are trying to get the character position for some other, bigger function. In order to provide more useful and pertinent help please provide the context for your need of the character position.
            • 3. Re: charPos from word[x].char[x]  ?
              Level 7

              "Chunick" <webforumsuser@macromedia.com> wrote in message
              news:evqpga$o6j$1@forums.macromedia.com...
              > ... however, I now just read this part:
              > "I obviously made that syntax up to show my point, but I can't use
              > offSet()
              > as there may be previous instances of the word I'm trying to find the
              > character pos for in the text member's string."
              >
              > which suggests that you are trying to get the character position for some
              > other, bigger function. In order to provide more useful and pertinent help
              > please provide the context for your need of the character position.

              I got it working now thanks! Range is indeed what I should have been using,
              and I found a way round the offset() issue.

              Thanks again for your help. :)

              Richard