home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / BLST10_2.ZIP / SAMPLES / PARSNAME.SCR < prev    next >
Encoding:
Text File  |  1990-08-22  |  1.4 KB  |  44 lines

  1. # PARSNAME.SCR
  2. # passed a string containing "USERNAME is phoning you" in variable @message
  3. # return USERNAME in @message
  4. #
  5. .lup
  6. #
  7. strlen @message                # get length of string
  8. set @str2 = @message            # save string
  9. set @len = @status            # save length
  10. #
  11. strinx @message, " "            # find where the next blank is
  12. if @status = "0"            # if no occurance
  13.     set @message = ""            #    then no name found, null out
  14.     goto .done                #    return to calling script
  15. end        
  16. let @trim = @status + 1            # we want the character after the blank
  17. #
  18. strtrim @message,@trim,@len        # extract from just after the blank to end
  19. let @trim = @trim - 2            # reset blank pointer to just before the blank
  20. #
  21. strtrim @str2,1,@trim            # remove the first word found in @str2
  22. if @str2 = "is"                # if the first word is 'is' then previous word was username
  23.      set @message = @savestr        # place the username into the message var
  24.      goto .done                # return to calling script
  25. end
  26. #
  27. set @savestr = @str2            # save extracted string
  28. goto .lup                # and try again
  29. #
  30. .done
  31. #
  32. strlen @message                # check username for length
  33. if @status = "0" goto .return        # if null return
  34. set @len = @status            # save length
  35. #
  36. strinx @message, "\n"            # see if there is a carriage return
  37. if @status = "0" goto .return        #  no - then return
  38. let @trim = @status + 1            # yes then
  39. strtrim @message,@trim,@len        # strip off
  40. #
  41. .return            
  42. return                    # return to calling script
  43.  
  44.