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

<StringScanner>.SkipOverString()

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

    <StringScanner>.SkipOverString()

    I am trying to parse a file using StringScanner. I have encountered a situation where I am having trouble determining if the string contains two delimiters in a row representing a field that has a null value. I have been using <StringScanner>.SkipOverString("*") to reliably skip past each field delimiter. However when the string contains "**" (Two delimiters in a row) the command <StringScanner>.SkipOverString("*") skips past both delimiters instead of just the first one.

    Is this the way it is supposed to work; or is this a bug? Could someone with version 12 test this for me?

    I have broken out the relevant section of code that is causing me issues. Hopefully someone can look at this and let me know their thoughts on it.

    Code:
    DIM vTextC as C
    vTextC  = "11.76**XX*"
    
    DIM ss as P
    ss = stringScanner.create(vTextC)
    	
    DIM vClp04C as C					'Monetary Amount - Claim Payment Amount	
    vClp04C = ss.ScanToString("*")		
    
    DIM vStartOffsetN as N
    vStartOffsetN = ss.Offset
    
    DIM vNumN as N
    vNumN = ss.SkipOverString("*")		'This line is skipping Two characters instead of the expected one character jump
    
    DIM vStopOffSetN as N
    vStopOffSetN = ss.Offset
    	
    DIM vClp05C as C					'Monetary Amount - Patient Responsibility Amount
    vClp05C = ss.ScanToString("*")
    ss.SkipOverString("*")
    
    Ui_msg_box("test", "Clp04: " + vClp04C + crlf(2) + "Start Offset: " + vStartOffsetN + crlf() + "Stop Offset: " + vStopOffSetN + crlf() + "Chars Skipped: " + vNumN + crlf(2) + "Clp05: " + vClp05C )
    Andrew

    #2
    Re: &lt;StringScanner&gt;.SkipOverString()

    I think this is one of those working as intended and not expected. If you put "****" in the text in your example and then start increasing the asterics to look for watch what happens. I think the scanner keeps going till the furthest possible match. so if you search on "*" then it will find "*" 4 times. If you search on "**" then it will find that 2 times. But if you search on "***" then it will find that once and there is no block of three next so it stops.

    If after you scan to "*" and the data is always after after 1 asteric then you could use ss.skipover(1)

    Note: I could not get ss.skipover() to return a true value as advertised. May be that should be reported.
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

    Comment


      #3
      Re: &lt;StringScanner&gt;.SkipOverString()

      It is working as advertised, but, you are confusing alpha and yourself.
      Strangely enough, I have done the same test that Tim did but hesitated to respond as I do not have v12. But when I saw Tim's response, I realized, it is the same in my version as in v12 but my conclusion is different from Tim's.
      As advertised:
      ScanToString() is supposed to go to the first occurrence of the string, and it does as evident in your example.
      The second part is the confusing part.
      As advertised , SkipOverString() is supposed to skip over the text you specified. It does.
      But,
      In your example, when it skips over the first *, it comes to the second one. And, as there is no other characters (breaking point) between the first and the second one, it does double duty and skips over the second one.

      To illustrate that, I used alpha's example, but instead of one "writer" I put two. In the first example, there is a space between the two. In the second one, I removed the space.
      Watch what happens here:
      dim scanner as P
      dim txt as C
      txt = <<%text%
      #This is wonderful prose written
      #by a technical writer writer of note.
      #%text%
      scanner = stringscanner.create(txt)
      ? scanner.SkipToString("writer")
      = .T.

      ? scanner.SkipOverString("writer")
      ? scanner.GetToOffset()
      = This is wonderful prose written
      by a technical writer

      ? scanner.getremainder()
      = writer of note.
      Now, change that text where you remove the space between writer writer:
      dim scanner as P
      dim txt as C
      txt = <<%text%
      #This is wonderful prose written
      #by a technical writerwriter of note.
      #%text%
      scanner = stringscanner.create(txt)
      ? scanner.SkipToString("writer")
      = .T.

      ? scanner.SkipOverString("writer")
      = 12

      ? scanner.GetToOffset()
      = This is wonderful prose written
      by a technical writerwriter

      ? scanner.getremainder()
      = of note.
      It skiped 12 characters , writerwriter and see where the offset went to? the end of the second writer not the first.
      I think, this is how it is meant to work.
      If you wish to find a two consecutive * in a string, there are other means to do that. String scanner seems an over kill here.

      Comment


        #4
        Re: &lt;StringScanner&gt;.SkipOverString()

        Tim:
        I am not sure about skipover(1) ?
        The function takes a character not a numeric argument.

        Andrew:
        Here is an easy way to find two consecutive identical characters:
        txt="abc**def"
        x1=at("*",txt,1)
        ?x1
        = 4
        x2=at("*",txt,2)
        = 5
        ?if(x2-x1=1, "Consecutive", "Not consecutive")
        = "Consecutive"
        Of course, you could use regex and other functions as well.

        Comment


          #5
          Re: &lt;StringScanner&gt;.SkipOverString()

          Originally posted by G Gabriel View Post
          Tim:
          I am not sure about skipover(1) ?
          The function takes a character not a numeric argument.
          http://wiki.alphasoftware.com/String...kipOver+Method
          Actually it does take numeric. One of only a few scanner functions that do. I have used it as such and the help does say it as well.
          Tim Kiebert
          Eagle Creek Citrus
          A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

          Comment


            #6
            Re: &lt;StringScanner&gt;.SkipOverString()

            Disregard. I was thing of .SkipOverString()

            Comment


              #7
              Re: &lt;StringScanner&gt;.SkipOverString()

              Another way to find 2 consecutive *, or in your case, find a blank "field" is simply to use word(), e.g.
              Code:
              txt="a,b,c,,e,,,f"
              dim flds as c=""
              x=occurs(",",txt)-1
              for i=1 to x
              	if word(txt,i,",")=""
              		flds=flds+"field "+i+" is blank"+crlf()
              	end if
              next i
              msgbox(flds)
              You could also initialize the text in an array and search for those blank fields.

              Comment


                #8
                Re: &lt;StringScanner&gt;.SkipOverString()

                Thank you for looking into it. It maybe working as intended however I disagree on the intent. This is the first time I have used stringscanner. When I was reading the documentation I thought it was funny that <StringScanner>.SkipOverString() returned the number of characters skipped. I figured if I really needed to know that I could just measure the length of the string presented in the argument. However now I understand why they return the characters skipped count.

                In the interest of "get it working" I ended up extracted to the segment terminator then used Word() to grab the individual elements.

                StringScanner may be overkill for this project however based on my initial research it is supposed to be faster than other string manipulation methods. I am re-writing this routine in hopes of gaining speed. The major vendors are able to read, format, and generate a printable report in less than a second. My first attempt at this resulted in a lag of several seconds up. Sometimes it is enough I can get up to get a cup of coffee and be back before the report is ready to print.
                Andrew

                Comment

                Working...
                X