home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / rexx / 931 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.7 KB  |  44 lines

  1. Newsgroups: comp.lang.rexx
  2. Path: sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!ugle!anders
  3. From: anders@lise3.lise.unit.no (Anders Christensen)
  4. Subject: Re: Blanks, REXX, and portability...
  5. In-Reply-To: Dave Gomberg's message of Sun, 6 Sep 1992 22:32:37 PDT
  6. Message-ID: <ANDERS.92Sep8143820@lise3.lise.unit.no>
  7. Sender: news@ugle.unit.no (NetNews Administrator)
  8. Organization: University of Trondheim, Norway
  9. References: <REXXLIST%92090701365930@UGA.CC.UGA.EDU>
  10. Date: 8 Sep 92 14:38:20
  11. Lines: 31
  12.  
  13. In article <REXXLIST%92090701365930@UGA.CC.UGA.EDU> Dave Gomberg <GOMBERG@UCSFVM.BITNET> writes:
  14.                                                              
  15. > I would really like Anders 
  16. > and other Unix types to say if they can stand it that:
  17. >
  18. >     c=a||b;  say pos(a,c)
  19. >
  20. > would say 0?
  21.  
  22. Why are you focusing on POS()? The description of POS() in TRL (2nd
  23. ed) doesn't even mention 'blank' or 'blanks'. Thus, POS() has nothing
  24. to do with whitespace, and is only suited to obscure this discussion.
  25.  
  26. The WORDPOS() built-in function is much more interesting, relevant and
  27. illustrative. I think it should return (using "\t" to denote Tabs, but
  28. note that this applies to other whitespace characters as well):
  29.  
  30.    wordpos( "a b",  "a b"  )   -->   1
  31.    wordpos( "a  b", "a b"  )   -->   1
  32.    wordpos( "a\tb", "a b"  )   -->   1
  33.    wordpos( "a b",  "a  b" )   -->   1
  34.    wordpos( "a b",  "a\tb" )   -->   1
  35.  
  36. Calling POS() instead, only the first of these returns 1, the rest
  37. return 0. (Unless you introduce regular expressions which, although a
  38. very interesting extension, is a totally different tread.)
  39.  
  40. -anders
  41.  
  42. PS: Under normal circumstances, your example says "0" iff 'a' is a
  43.     variable set to the nullstring. 
  44.