OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 6:24 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: C tolower() function
PostPosted: Fri Jan 17, 2003 7:57 am 
Hi,

Is it part of the c standard for the tolower() and toupper() functions to first check for an alpha char before performing the conversion?

thanks.


Top
  
 
 Post subject: Re:C tolower() function
PostPosted: Fri Jan 17, 2003 11:40 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 22, 2004 11:00 pm
Posts: 1076
non alpha dont have upper/lower case. and afaik, is not defined to work on non-english languages.?

so only A-Za-z work for ansi toupper/tolower

_________________
-- Stu --


Top
 Profile  
 
 Post subject: Re:C tolower() function
PostPosted: Sat Jan 18, 2003 3:16 am 
Thanks, I understand that, but what I mean is if a semi-colon (0x3b) is passed to the tolower() function, it will attempt to clear bit 5, which of course should not be done, so does it check for an alpha character before perofming the operation or does it just blindly clear bit 5?

thanks again.


Top
  
 
 Post subject: Re:C tolower() function
PostPosted: Sat Jan 18, 2003 7:33 am 
tolower and toupper will handle non-alphabetic characters correctly.

From http://www.dinkumware.com/manuals/reader.aspx?b=p/&h=ctype.html#tolower:

tolower
[tt]int tolower(int c);[/tt]
The function returns the corresponding lowercase letter if one exists and if [tt]isupper(c)[/tt]; otherwise, it returns [tt]c[/tt].

toupper
[tt]int toupper(int c);[/tt]
The function returns the corresponding uppercase letter if one exists and if [tt]islower(c)[/tt]; otherwise, it returns [tt]c[/tt].


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 63 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group