home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 12963 < prev    next >
Encoding:
Text File  |  1992-08-30  |  1.4 KB  |  45 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!ukma!darwin.sura.net!Sirius.dfn.de!math.fu-berlin.de!informatik.tu-muenchen.de!hphalle6!behrenss
  3. From: behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens)
  4. Subject: Re: Order of execution...
  5. Keywords: Umm, Uhh, Well, Daa, Gee
  6. References: <7942@lee.SEAS.UCLA.EDU>
  7. Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
  8. Organization: Technische Universitaet Muenchen, Germany
  9. Date: Sun, 30 Aug 1992 17:40:34 GMT
  10. Message-ID: <behrenss.715196434@hphalle6>
  11. Distribution: usa
  12. Lines: 31
  13.  
  14. linley@seas.ucla.edu (Bruce Linley) writes:
  15.  
  16. >This subroutine is supposed to convert a string to all lower case:
  17. >int StripCase(textLine)
  18. >char textLine[];
  19. >{
  20. >  register int index = 0;
  21. >  
  22. >  while ((textline[index++] = tolower(textLine[index])) != '\0');
  23. >}
  24. >The question is will it always work?
  25.  
  26. No. 
  27.  
  28. Better would be: 
  29.  
  30. for(;(textline[index] = tolower(textline[index])) != '\0';index++);
  31.                                     ^
  32.                     I assume you made a typo here and
  33.                     there is no textLine.
  34.  
  35. BTW, this will only work for "printable" ASCII characters, so you are in
  36. the dark if the text uses Umlaute or similar.
  37.  
  38. Yours
  39. Soenke
  40. -- 
  41. ===========================================================================
  42. More than silver, more than gold, I need   !    behrenss@informatik.
  43. electricity. I need it for my dreams.      !    tu-muenchen.de
  44. (RACTER)                                   !  FIDO: 2:246/13 Soenke Behrens
  45.