Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Stripping a string except...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Stripping a string except...

    The following is an example of a string I am working with.

    ABC Prospect1234 5th StreetVero Beach~7333

    I need to strip everything except the numbers that follow the tilda "~" symbol.

    The number following the ~ could be any length, so the str, left and right functions do not seem to me to be viable solutions.

    Thanks

    Louis

    #2
    RE: Stripping a string except...

    Louis, why not?

    Assuming there will always only be one tilde in each string... you could

    use len() and trim() to get the trimmed string length;
    use at() to get the position of the tilde;
    subtract the position from the length and you get the number of chars to extract using substr().

    Alpha's string functions are great.

    This hasn't been tested but you'd wind up with something like this:

    ltrim(substr(your_string_name, AT("~", your_string_name) +1 , len(trim(substr(your_string_name)) - AT("~", your_string_name)))

    -- tom

    Comment


      #3
      RE: Stripping a string except...

      Got It!

      For those whom are interested...

      AT()found the location of the ~
      Substr() gave me the number following the ~

      Louis

      Comment


        #4
        RE: Stripping a string except...

        Tom,

        I think we were typing our replys at the same time.

        I got it working, but your idea sounds even better. I'll give it a go and let you know how it turns out.


        Thanks

        Louis

        Comment


          #5
          RE: Stripping a string except...

          And the right() function can perform the same magic.

          test = "ABC Prospect1234 5th StreetVero Beach~7333 "
          rem = right(alltrim(test),len(alltrim(test))-at("~",test))
          ? rem
          = "7333"

          or if your "~" is always the rightmost 4 significant characters

          rem = right(alltrim(test),4)
          There can be only one.

          Comment


            #6
            RE: Stripping a string except...

            Meant to say

            or if your numbers after the "~" are always the rightmost 4 significant characters
            There can be only one.

            Comment


              #7
              RE: Stripping a string except...

              Since this is along the same lines as what I need to do I thought I would ask this here. How would you strip a string like this?

              Code:
              test = "C:\Data\Alpha5 Databases\AlphaTestDogs\Images\default.jpg"
              
              rem = right(alltrim(test),len(alltrim(test))-at("\",test))
              ERROR: Expected value
              
              ?rem
              If I put a \ I get the error. I can use a . and just get the file extension jpg.


              What I eventually want to do is get the image filename from an image file reference field and place just the name of the photo in another field named imagefile. This would be so I can verify that the photo is correct for the record.

              Thanks

              Phil

              Comment


                #8
                RE: Stripping a string except...

                Phil,

                As there would be so many substrings I feel it would be better if you use the Update Operation. Where you can split a string in to a number of fields at the point of the "\".

                Keith Hubert
                London.
                Regards
                Keith Hubert
                Alpha Guild Member
                London.
                KHDB Management Systems
                Skype = keith.hubert


                For your day-to-day Needs, you Need an Alpha Database!

                Comment


                  #9
                  RE: Stripping a string except...

                  Phil,

                  you're working with a special case.

                  The backslash is the line continuation symbol in Alpha Five. Try substituting chr(92) for the backslash.

                  AND, there's a new method for the FILE object in Vers. 5. Check the docs on:

                  File.filename_parse()

                  -- tom

                  Comment


                    #10
                    RE: Stripping a string except...

                    The backslash is also the "escape" character for quote marks, so in the at("\",test), it is getting interpreted incorrectly. You merely need to escape the escape character like:

                    test = "C:\Data\Alpha5 Databases\AlphaTestDogs\Images\default.jpg"

                    rem = right(alltrim(test),len(alltrim(test))-at("\\",test))

                    ? rem
                    = "Data\Alpha5 Databases\AlphaTestDogs\Images\default.jpg"

                    That said, the other options of filename_parse() are likely easier to use.
                    There can be only one.

                    Comment


                      #11
                      RE: Stripping a string except...

                      I thought what I wanted was a special case, most of what I want seems to be.

                      I tried the file.filename_parse(filename,"n") and looks as if I get what I want. I'll experment with everyones ideas some today at work if I have time.

                      [code]test = "C:\Data\Alpha5 Databases\AlphaTestDogs\Images\default.jpg"
                      ?file.filename_parse(test,"n")
                      = "default"

                      I learned somethng, Thanks

                      Phil

                      Comment


                        #12
                        RE: Stripping a string except...

                        Even simpler would be the word() function. As it takes an optional parameter to specify word boundaries, all you would need to do is:

                        ?word("ABC Prospect1234 5th StreetVero Beach~7333 ",1,"~")
                        = "ABC Prospect1234 5th StreetVero Beach"


                        -Lenny

                        Lenny Forziati
                        Vice President, Internet Products and Technical Services
                        Alpha Software Corporation

                        Comment


                          #13
                          RE: Stripping a string except...

                          cc = "ABC Prospect1234 5th StreetVero Beach~7333"
                          dd = left(cc, at("~",cc)-1)
                          ? dd = "ABC Prospect1234 5th StreetVero Beach"

                          Comment

                          Working...
                          X