STRIP-Func

 

 

NOTE - Use your Browsers BACK Button to return to prior page or CLICK here.

   STRIP-Func - STRIP Characters from String
Zlion.jpg (26856 bytes) This simple routine will STRIP all occurances of your specified characters from the input string... a practical example of this may be 'stripping' commas from a string containing an amount... a simple call to the STRIP-Func routine does the job... Also on this page are lion and tiger pictures (from my Zoo Animals collection for my daughter)...

You can find the STRIP-Func function in my custom SQR library TDFUNC.SQC

   REPL-Func - Input / Output Parameters
 
Input    - Input String
Input    - Characters to Strip
Output  - Output String (With characters stripped)

EXAMPLE:

let $alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

do STRIP-Func($alphabet, 'AEIOU', $consonants)
do STRIP-Func($alphabet, 'BCDFGHJKLMNPQRSTVWXYZ', $vowels)

show '     Complete Alphabet: ' $alphabet
show 'Consonants in Alphabet: ' $consonents
show '    Vowels in Alphabet: ' $vowels
     

The original string, $alphabet, contains all 26 characters of the alphabet... the first STRIP-func performed will strip all vowels (AEIOU) from the string leaving only consonants (in the $consonants variable)... the second STRIP-Func will 'strip' all consonants from the $alphabet variable leaving only vowels (in the $vowels variable)... this is a simple, but effective routine...

   Picture Archive... Another creation from 1972 (4th grade)...
arc_002.jpg (25701 bytes) Here's another of my works - I was 9 years old when I drew this owl! My mom found a box of my old pictures in her attic... I'm glad she saved them!

   STRIP-Func - Source Code
!**********************************************************************
!*       Strip Characters from String                                 *
!**********************************************************************
!*                                                                    *
!*        INPUT: $I_string  - Input String                            *
!*               $I_strip   - Characters to Strip                     *
!*       OUTPUT: $O_string  - Output String (Stripped)                *
!*                                                                    *
!*               To de-activate this function:                        *
!*               #define STRIP_Func_Remove                            *
!*                                                                    *
!**********************************************************************
!*                                                                    *
!*      EXAMPLE: do STRIP-Func('HELLO, WORLD', 'AEIOU ', $O_string)   *
!*                                                                    *
!*      RESULTS: $O_string = 'HLL,WRLD' (Vowels/Blanks Stripped)      *
!*                                                                    *
!**********************************************************************

#ifndef STRIP_Func_Remove

begin-procedure STRIP-Func($I_string, $I_strip, :$O_String)

let $O_string    = ''
let #len         = length($I_string)
let #pos         = 1

while #pos      <= #len

   let $char     = substr($I_string, #pos, 1)

   if  instr($I_strip, $char, 1) = 0
       let $O_string = $O_string || $char
   end-if

   let #pos      = #pos + 1

end-while

end-procedure

#endif

!**********************************************************************
                                                                                              

   Feedback
ftoct01.jpg (12389 bytes) I would appreciate any feedback you may have on this site. Send mail to tdelia@erols.com or click on the Octopus.

   Technical difficulties?
Ztiger.jpg (23394 bytes) Please report any technical difficulties you may encounter to the address above OR click on the Octopus. Thanks.

NOTE - Use your Browsers BACK Button to return to prior page.

Tony DeLia - Updated June 04, 2000