home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / qb_sub / case.sub next >
Encoding:
Text File  |  1987-07-14  |  3.2 KB  |  75 lines

  1. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. '%  (C) 1987 HUMBLEWARE Custom Programming    Author: Lawrence A. Westhaver  %
  3. '%        247 Paul Martin Drive,  Baltimore MD  21227  (301) 799-1975        %
  4. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. '%                                                                           %
  6. '%     FILENAME: CASE.SUB                        LAST UPDATE: 06-06-1987     %
  7. '%                                                                           %
  8. '%  DESCRIPTION: Two routines that convert strings to upper or lower case.   %
  9. '%                                                                           %
  10. '%         CALL: CALL xCASE(IN$,OUT$)                                        %
  11. '%                                                                           %
  12. '%                 UCASE: Converts string to upper case.                     %
  13. '%                                                                           %
  14. '%                 LCASE: Converts string to lower case.                     %
  15. '%                                                                           %
  16. '%       INPUTS: IN$  = Input string.                                        %
  17. '%                                                                           %
  18. '%      OUTPUTS: OUT$ = Copy of input string converted to upper or lower     %
  19. '%                      case.                                                %
  20. '%                                                                           %
  21. '%         NOTE: These routines do not alter the original string specified   %
  22. '%               in IN$. They return a copy of the original string in OUT$   %
  23. '%               with case conversion performed on the copy.                 %
  24. '%                                                                           %
  25. '%               If you want the original string altered, then call the      %
  26. '%               needed routine like this:                                   %
  27. '%                                                                           %
  28. '%                             CALL xCASE(IN$,IN$)                           %
  29. '%                                                                           %
  30. '%               This will cause the copy of the original string to be       %
  31. '%               assigned to the original.                                   %
  32. '%                                                                           %
  33. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  34.  
  35.  
  36. SUB UCASE(IN$,OUT$) Static
  37.  
  38.  
  39. 'copy input string to output string
  40.  
  41.     OUT$=IN$
  42.  
  43. 'convert output string to uppercase
  44.  
  45.     FOR LEWP%=1 TO LEN(OUT$)
  46.       CHAR$=MID$(OUT$,LEWP%,1)
  47.       IF ASC(CHAR$)>96 AND ASC(CHAR$)<123 THEN
  48.         MID$(OUT$,LEWP%,1)=CHR$(ASC(CHAR$)-32)
  49.       END IF
  50.     NEXT LEWP%
  51.  
  52.  
  53. END SUB 'ucase
  54.  
  55.  
  56.  
  57. SUB LCASE(IN$,OUT$) Static
  58.  
  59.  
  60. 'copy input string to output string
  61.  
  62.     OUT$=IN$
  63.  
  64. 'convert output string to lowercase
  65.  
  66.     FOR LEWP%=1 TO LEN(OUT$)
  67.       CHAR$=MID$(OUT$,LEWP%,1)
  68.       IF ASC(CHAR$)>64 AND ASC(CHAR$)<91 THEN
  69.         MID$(OUT$,LEWP%,1)=CHR$(ASC(CHAR$)+32)
  70.       END IF
  71.     NEXT LEWP%
  72.  
  73.  
  74. END SUB 'lcase
  75.