Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - tolower() return character code in lower case http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 tolower()           Return character code in lower case
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func uint tolower extern
   param value uint uASCII

 Arguments
   uASCII is the character code to convert to lower case.

 Return
   The ASCII code of the lower case character.

 Description
   The tolower() function returns the lower case equivalent of the passed
   character code. Extended characters, including German "Umlauts" are
   treated correctly.

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   func char MyLower1
   param const char cString
   // A variant of the lower() function that uses the tolower() function
   // to replace string bytes
   vardef
      byte aContents[ 255 ] based cString
      uint n
   enddef
   n := 0
   do while aContents[ n ] > 0
      aContents[ n ] := tolower( aContents[ n ] )
      n++
   enddo
   return( cString )
   endfunc
   
   func char MyLower2
   param const char cString
   // A variant of the lower() function that ustilizes pointers and does
   // not call the tolower() function
   vardef
      ptr( byte ) pContents
   enddef
   pContents := &cString
   do while *pContents
      if *pContents >= 'A' .and. *pContents <= 'Z'
         *pContents += 'a' - 'A'
      endif
      pContents++
   enddo
   return( cString )
   endfunc
   
   proc Test_tolower
   ? chr( tolower( 'A' ) )
   ? chr( tolower( '1' ) )
   ? chr( tolower( 'z' ) )
   ?
   ? MyLower1( "Brigitte Bardot" )
   ? MyLower2( "Marilyn Monroe" )
   endproc

   proc main
   Test_tolower()
   endproc

See Also: toupper()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson