home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 01e / let12.zip / DEMO-4.BAT < prev    next >
DOS Batch File  |  1987-09-17  |  1KB  |  41 lines

  1. echo Off
  2. If `%Name%' == `' Demo
  3. if `%1' == `AskAgain' goto AskAgain
  4. cls
  5. echo   ╔════════════════════════════════════════════════════════════════╗
  6. echo ┌─╫────────────────────────────────────────────────────────────────╫─┐
  7. echo │ ║   String Manipulation (part 1): UPPER, LOWER, PROPER           ║ │
  8. echo └─╫────────────────────────────────────────────────────────────────╫─┘
  9. echo   ╚════════════════════════════════════════════════════════════════╝
  10. echo  
  11. echo One of the most powerful features of LET is its ability to
  12. echo Manipulate Strings!  Let me show you just some of the possibilities.
  13. echo  
  14. :AskAgain
  15. LET Str=(ask "Give me a line of text: ")
  16. LET Check=(substr (- 60 (length Str)) 1 1)
  17. rem the previous check determines if the length is greater than 60
  18. rem by seeing if the subtraction results in a negative number.
  19. if not `%Check%' == `-' goto OkStrLen
  20. LET Str=(substr Str 1 60)
  21. echo %Name%, that string is a bit long, so I'm going to
  22. echo shorten it down a bit, if you don't mind.  We'll use the string
  23. echo "%Str%"
  24. :OkStrLen
  25. if not `%Check%' == `6' goto NotNull
  26. LET Str="This is a PROVIDED string for YoUr BeNeFit!"
  27. echo Ok, so you're shy.  I'll provide the string:
  28. echo It is this---> %Str%
  29. :NotNull
  30. echo I'm going to fool around with the cases of letters, for example:
  31. LET dummy=(do "ShiftCas")
  32. echo Upper Case:  %U%
  33. echo Lower Case:  %L%
  34. echo Capitalized: %P%
  35. echo  
  36. pause
  37. set U=
  38. set L=
  39. set P=
  40. DEMO-5
  41.