New call-to-action
Results 1 to 5 of 5

Thread: Remove Alpha Characters

  1. #1
    Member Jerry Hartness's Avatar
    Real Name
    Jerry Hartness
    Join Date
    Apr 2000
    Location
    Knoxville, TN
    Posts
    427

    Default Remove Alpha Characters

    I have a field called size

    the size is listed as example:

    P20575R15 or 1000R20

    I have another field called AltSize (Alternative Size)
    which is a calc field and I want to
    take the field size and strip all the alpha characters
    from it and the AltSize would read per the example

    2057515 or 100020

    I have looked thru the manual with no avail as to how
    to do this. The remspecial will remove non-nuneric and
    non-alpha but not the alpha. If the transform function
    does this, I can't figure it out. I can manually enter the
    AltSize but I have about 2000 sizes and I am looking
    for the short cut.

    Thanks,

    Jerry

  2. #2
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default RE: Remove Alpha Characters

    Jerry:

    I'm sure that there must be an Alpha function available to do this, but on the off-chance there is not, here's one I just ran up ....

    '=====
    function NoLetters as C(input as c)
    dim output as c
    charlength=len(alltrim(input))
    i=0
    for i=1 to charlength
    isnum=isalpha(substr(input,i,1))
    if .not. isnum then
    output=output+substr(input,i,1)
    end if
    next
    noletters=output
    end function
    '=====

    so

    input="P123Q456R"
    result=noletter(input)
    ?result
    123456


    Finian

  3. #3
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Remove Alpha Characters

    Sweet.

  4. #4
    Member
    Real Name
    Bill Warner
    Join Date
    Apr 2000
    Posts
    905

    Default RE: Remove Alpha Characters

    Here's another way to do it:

    dim global mg as c
    dim global len as n

    t=table.current()
    t.fetch_first()

    for rec=1 to 2
    msg=t.size
    len=len(trim(msg))
    for x=1 to len
    if asc(substr(msg,x,1))>57
    msg=substr(msg,1,x-1)+" "+substr(msg,x+1,20)
    end if
    next x
    t.change_begin()
    t.size2=remspecial(msg)
    t.change_end()
    t.fetch_next()
    next rec

    parentform.resynch()

    This script puts a space where letters are, as defined by their ASC value greater than 57 (which is a zero). Then I used REMSPECIAL to eliminate the blanks.

    Yes, the space was necessary, because otherwise it would ignore the second of two consecutive letters.

  5. #5
    Member Jerry Hartness's Avatar
    Real Name
    Jerry Hartness
    Join Date
    Apr 2000
    Location
    Knoxville, TN
    Posts
    427

    Default RE: Remove Alpha Characters

    Finian, Stan, & Bill

    Thanks for your help. I almost got one of them to work, but
    found that "search & replace" (Found all instances of
    any alpha and non-alpha characters and replace them with
    nothing)worked great. For all you die-hard programmers out
    there that deal with part numbers using an Alternative Part
    Number will create a excellent search tool.

    Ex: If you have parts like:
    A100
    B100
    100AZ
    100-A etc..etc

    You create a Alternative Number, in this case, would be 100. Placing
    a embedded browse somewhere and do a search just on the Alternative
    Part would bring up all instances of the above Parts.

    thanks again,
    back to work
    Jerry

Similar Threads

  1. Remove Scripts
    By Walter in forum Alpha Five Version 6
    Replies: 5
    Last Post: 06-15-2005, 06:22 AM
  2. Non Alpha-Numeric Characters in Layout Names
    By Robert Davis in forum Alpha Five Version 5
    Replies: 10
    Last Post: 06-08-2004, 07:33 AM
  3. Remove the Alpha splash screen?
    By Paul H in forum Alpha Four Versions 7 and 8
    Replies: 3
    Last Post: 12-05-2002, 09:37 PM
  4. Remove toolbars
    By Edward F. Schulz in forum Alpha Five Version 4
    Replies: 3
    Last Post: 04-11-2002, 12:03 PM
  5. function to strip all alpha characters?
    By Daniel Weiss in forum Alpha Five Version 4
    Replies: 5
    Last Post: 01-08-2002, 01:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •