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

blank spaces in a phone number

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

    blank spaces in a phone number

    How can i eliminate blank spaces within a phone number
    such as:

    +49 40 377 415 --" +4940377415
    +380 4877 23089 --" +380487723089

    Regards,
    Corneliu

    #2
    RE: blank spaces in a phone number

    You could parse the string into two pieces.
    Put the plus symbol in the first part.
    Use remspecial() to remove the blanks from the second part.
    Reassemble the parts into a new string.

    -- tom

    Comment


      #3
      RE: blank spaces in a phone number

      new_phone_number = stritran(old_phone_number, " ", "")

      Comment


        #4
        RE: blank spaces in a phone number

        Very nice, Ed. Much easier than what I was thinking of.

        -- tom

        Comment


          #5
          RE: blank spaces in a phone number

          Thanks a lot. it works great!
          Regards,
          Corneliu

          Comment


            #6
            RE: blank spaces in a phone number

            stritran() does a case-insensitive replacement, while strtran() does a case-sensitive replcement. Allowing for case-insensitivity decreases performance. While in this case the difference in execution speed will be negligible, most people are not aware of this issue and always use stritran() even when they do not need to. I suggest using strtran() instead whenever possible. So in this case, I would use:

            new_phone_number = strtran(old_phone_number," ","")

            -Lenny

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

            Comment


              #7
              RE: blank spaces in a phone number

              thank you very much for explanation

              Regards,
              Corneliu

              Comment


                #8
                RE: blank spaces in a phone number

                I couldn't help it, I had to do some comparisons. I also noted a possible advantage to Tom's original idea of using remspecial().

                With remspecial() all special characters are removed. This means that it will also remove any dashes, parenthesis, etc. that the user may accidentally (or improperly) enter.

                Below is my test script. Note the output results and slight speed increase with remspecial(). It's the fastest as well as removing all special characters.

                Unfortunately Lenny, this doesn't support your "strtran() is faster than stritran()" theory but the logic to your theory seems correct so I suspect there's something else involved in this case.

                stime = now()
                FOR qx = 1 to 20000
                a = stritran( "+49 (40) 377-415", " ", "" )
                NEXT
                ui_msg_box( "TIME stritran", ltrim(str(now()-stime,10,3 )) +crlf(2)+ a)
                stime = now()
                FOR qx = 1 to 20000
                a = strtran( "+49 (40) 377-415", " ", "" )
                NEXT
                ui_msg_box( "TIME strtran", ltrim(str(now()-stime,10,3 )) +crlf(2)+ a)
                stime = now()
                FOR qx = 1 to 20000
                a = "+" + remspecial( "+49 (40) 377-415" )
                NEXT
                ui_msg_box( "TIME remspecial", ltrim(str(now()-stime,10,3 )) +crlf(2)+ a)

                (I'm sure some of you will be saying, "Why 'qx'?" Ask yourself - would you rather search a large script for a variable named 'x' and find 20 bad hits in words like 'text' along with the 3 valid hits or do a search on 'qx' and find only the 3 valid hits? A very wise person once told me that when I thought about making things as easy as possible for myself I should think about making it easy for the long term because making the short term easy often makes the long term more difficult.)

                Cal Locklin
                www.aimsdc.net

                Comment


                  #9
                  RE: blank spaces in a phone number

                  I suppose I should have included the results:

                  stritran -- .390 seconds -- +49(40)377-415
                  strtran -- .406 seconds -- +49(40)377-415
                  remspecial -- .343 seconds -- +4940377415

                  The times varied a bit but this was about the most common result I saw.

                  Obviously, time is really not a big factor here but the output results might be.

                  Comment


                    #10
                    RE: blank spaces in a phone number

                    Cal,

                    The resolution of the timer is not enough to be really valid. You need to increase the time so that it is greater than about 2 seconds to be totally valid to reasonable accuraacy.

                    The other aspect is that in addition to the line of interest, you are executing the loop the same number of times. You need to subtract out an empty loop time to get truly valid values and an approximation of true numbers. Other wise it's only the difference that tells you how much difference the two are, but not how much the total time would really be.

                    Regards,

                    Ira
                    Regards,

                    Ira J. Perlow
                    Computer Systems Design


                    CSDA A5 Products
                    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                    CSDA Barcode Functions

                    CSDA Code Utility
                    CSDA Screen Capture


                    Comment


                      #11
                      RE: blank spaces in a phone number

                      Using the following, I got 4.828, 2.406 and 2.406 respectively. Stritran does take longer.

                      Regards,

                      Ira


                      Iterate=100000

                      stime = now()
                      FOR qx = 1 to Iterate
                      NEXT
                      looptime=NOW()-stime

                      FOR qx = 1 to Iterate
                      a = stritran( "+49 (40) 377-415", " ", "" )
                      NEXT
                      a1=NOW()-stime
                      a1=a1-looptime
                      ui_msg_box( "TIME stritran", ltrim(str(a1,10,3 )) +crlf(2)+ a)

                      stime = now()
                      FOR qx = 1 to Iterate
                      a = strtran( "+49 (40) 377-415", " ", "" )
                      NEXT
                      a2=NOW()-stime
                      a2=a1-looptime
                      ui_msg_box( "TIME strtran", ltrim(str(a2,10,3 )) +crlf(2)+ a)

                      stime = now()
                      FOR qx = 1 to Iterate
                      a = "+" + remspecial( "+49 (40) 377-415" )
                      NEXT
                      a3=NOW()-stime
                      a3=a1-looptime
                      ui_msg_box( "TIME remspecial", ltrim(str(a3,10,3 )) +crlf(2)+ a)

                      end
                      Regards,

                      Ira J. Perlow
                      Computer Systems Design


                      CSDA A5 Products
                      New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                      CSDA Barcode Functions

                      CSDA Code Utility
                      CSDA Screen Capture


                      Comment


                        #12
                        RE: blank spaces in a phone number

                        Slight mistake in above code. The corrected times for the code below are;

                        Loop overhead is 2.656 seconds
                        Stritan 5.531 (without loop overhead)
                        Strtran 2.625 (without loop overhead)
                        remspecial 2.438 (without loop overhead)


                        Regards,

                        Ira

                        ' iteration count � should end up with times " about 5 sec
                        ' or more without being too slow to test
                        Iterate=100000
                        msg=""

                        stime = now()
                        FOR qx = 1 to Iterate
                        NEXT
                        looptime=NOW()-stime
                        msg=msg+"TIME loop "+" "+ltrim(str(looptime,10,3 ))+CRLF(2)

                        FOR qx = 1 to Iterate
                        a = stritran( "+49 (40) 377-415", " ", "" )
                        NEXT
                        a1=NOW()-stime
                        a1=a1-looptime
                        'ui_msg_box("TIME stritran", ltrim(str(a1,10,3 )) +crlf(2)+ a)
                        msg=msg+"TIME stritran "+" "+ltrim(str(a1,10,3 ))+"Value="+a+CRLF()

                        stime = now()
                        FOR qx = 1 to Iterate
                        a = strtran( "+49 (40) 377-415", " ", "" )
                        NEXT
                        a2=NOW()-stime
                        a2=a2-looptime
                        'ui_msg_box( "TIME strtran", ltrim(str(a2,10,3 )) +crlf(2)+ a)
                        msg=msg+"TIME strtran "+" "+ltrim(str(a2,10,3 ))+"Value="+a+CRLF()

                        stime = now()
                        FOR qx = 1 to Iterate
                        a = "+" + remspecial( "+49 (40) 377-415" )
                        NEXT
                        a3=NOW()-stime
                        a3=a3-looptime
                        'ui_msg_box( "TIME remspecial", ltrim(str(a3,10,3 )) +crlf(2)+ a)
                        msg=msg+"TIME remspecial"+" "+ltrim(str(a3,10,3 ))+"Value="+a+CRLF()

                        ui_msg_box( "TIME",msg)

                        end
                        Regards,

                        Ira J. Perlow
                        Computer Systems Design


                        CSDA A5 Products
                        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                        CSDA Barcode Functions

                        CSDA Code Utility
                        CSDA Screen Capture


                        Comment


                          #13
                          RE: blank spaces in a phone number

                          Ira! You left out an "stime = now()" before the Stritran() loop so it is adding the loop time twice. This has a slight (!) tendency to increase the apparent time to run Stritran().

                          After adding the "stime = now()", I get approximately the same relative results as before - Stritran() takes slightly longer that Strtran().

                          It still seems like Lenny's comment makes sense so I'd be curious to know why it doesn't seem to be working. I'd play with it more but don't have the time right now. In fact, I shouldn't even be on the board but I just had to "take a rest."

                          By the way, I did initially use a higher loop number but tried the reduced version and it gave about the same results so I posted that one so others wouldn't get impatient and try to shut it down before it was done.

                          Cal Locklin
                          www.aimsdc.net

                          PS: Now I know why you've seemed to be getting a little crazy lately ... I'm about driven nuts by the long times to save some A5 stuff and to open large folders in Windows Explorer - you must be getting driven right over the edge if you're using that computer for development and it's taking 2.5 times a long. My loop time was only .907 seconds - and I thought my computer was getting out of date.

                          Comment


                            #14
                            RE: blank spaces in a phone number

                            Cal,

                            Right you are about the stime=now().

                            That explains my confusion of STRITRAN being twice as long as STRTRAN. The numbers are now more in line with my intuition. So, my corrected numbers are

                            2.516 loop
                            2.437 stritran
                            2.484 strtran
                            2.296 remspecial

                            But as for the absolute times, I'm running the test with A5V6, Pentium 4, 3 Ghz system, 1 Gig PC3200 memory, 7200RPM Hard Drives. If you are saying I'm running slow, then we should identify the cause of A5 to running slower.

                            I do have a lot of spyware, anti-virus and other protection software in, but removal doesn't seem to make much of a difference. These shouldn't be the cause, because files are not being accessed or modified/created.

                            I tried running in Safe mode, but something else has occured in my system, as it just reboots every time I go into safe mode (didn't use to do that). I'd really hate to have to do another reload of Win XP :(

                            Anyway, if you can explain your numbers and environment, I'll try to ascertain the offending program, and then we can report as an anamoly of A5.

                            Regards,

                            Ira
                            Regards,

                            Ira J. Perlow
                            Computer Systems Design


                            CSDA A5 Products
                            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                            CSDA Barcode Functions

                            CSDA Code Utility
                            CSDA Screen Capture


                            Comment


                              #15
                              RE: blank spaces in a phone number

                              Other than the fact that mine is a 2.4 Ghz system and I'm not sure what type of memory I have (but it is 1 Gig), our specs are the same.

                              I have turned off or tweaked a few system settings. Unfortunately, I can't tell you just what they were. Maybe they made more difference than I thought. If you want it, I will send you some of the most likely settings that I may have changed but it would take a lot of detective work to find out which ones have or have not actually been changed on my system. Most of them did not make any detectable difference at the time.

                              Cal Locklin
                              www.aimsdc.net

                              Comment

                              Working...
                              X