473,749 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

conversion of string to all lower case

DJ
Can someone tell me the library call that converts strings to lower case or
retrns a new string that is lower case of the original, thanks

im using <string>

David
Jul 22 '05 #1
22 6443
DJ
Or perhaps even better a compare that ignores case.

thanks

"DJ" <ch*****@earthl ink.net> wrote in message
news:vV******** ********@newsre ad3.news.pas.ea rthlink.net...
Can someone tell me the library call that converts strings to lower case or retrns a new string that is lower case of the original, thanks

im using <string>

David

Jul 22 '05 #2
DJ wrote:

Or perhaps even better a compare that ignores case.

thanks

"DJ" <ch*****@earthl ink.net> wrote in message
news:vV******** ********@newsre ad3.news.pas.ea rthlink.net...
Can someone tell me the library call that converts strings to lower case

or
retrns a new string that is lower case of the original, thanks

im using <string>

David


The discussion regarding the (international) caveats of lower/upper case and
case-insensitive *word* comparisons comes up monthly. Check the Google Groups
archives for more blather than you want to read, as well as a couple of
(somewhat) portable/internationaliz ed solutions.
Jul 22 '05 #3
Julie wrote:
The discussion regarding the (international) caveats of lower/upper case and
case-insensitive *word* comparisons comes up monthly. Check the Google Groups
archives for more blather than you want to read, as well as a couple of
(somewhat) portable/internationaliz ed solutions.

I am confused by your terminology "internatio nal" here. What do you mean?

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #4
DJ wrote:
Can someone tell me the library call that converts strings to lower case or
retrns a new string that is lower case of the original, thanks

im using <string>

David

Check std::toupper() and std::tolower() functions of <cctype>.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #5
Ioannis Vranos wrote:
Julie wrote:
The discussion regarding the (international) caveats of lower/upper case
and case-insensitive *word* comparisons comes up monthly.
Check the Google Groups archives for more blather than you want to read,
as well as a couple of (somewhat) portable/internationaliz ed solutions.


I am confused by your terminology "internatio nal" here. What do you mean?


One example is the german character ß that doesn't have a single uppercase
equivalent. 'Fuß' would need to compare equal to 'FUSS'.

Jul 22 '05 #6
Rolf Magnus wrote:
One example is the german character ß that doesn't have a single uppercase
equivalent. 'Fuß' would need to compare equal to 'FUSS'.

This is not the case here, since we are talking about std::string.

About multilingual characters, one should use wchar_t, std::wstring and
the std::towlower() , std::towupper() of <cwctype>, all guaranteed to work.
C++98:

"Type wchar_t is a distinct type whose values can represent distinct
codes for all members of the largest extended character set specified
among the supported locales (22.1.1). Type wchar_t shall have the same
size, signedness, and alignment requirements (3.9) as one of the other
integral types, called its underlying type."


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #7
Ioannis Vranos wrote:
Rolf Magnus wrote:
One example is the german character ß that doesn't have a single
uppercase equivalent. 'Fuß' would need to compare equal to 'FUSS'.

This is not the case here, since we are talking about std::string.

About multilingual characters, one should use wchar_t, std::wstring and
the std::towlower() , std::towupper() of <cwctype>, all guaranteed to work.


How do those handle such a conversion? The main point here is that the
number of characters in the uppercase version and in the lowercase version
are not equal. Character-based toupper and tolower can't handle that.

Jul 22 '05 #8
Rolf Magnus wrote:
How do those handle such a conversion? The main point here is that the
number of characters in the uppercase version and in the lowercase version
are not equal. Character-based toupper and tolower can't handle that.



However they work for Greek and English and I assume all languages with
one to one, lower-case to upper-case correspondence, so I guess it is
for such languages and up to the programmer to take this decision.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #9
Ioannis Vranos wrote:

Julie wrote:
The discussion regarding the (international) caveats of lower/upper case and
case-insensitive *word* comparisons comes up monthly. Check the Google Groups
archives for more blather than you want to read, as well as a couple of
(somewhat) portable/internationaliz ed solutions.


I am confused by your terminology "internatio nal" here. What do you mean?


I mean that there are languages that apparently do not have a 1-1
correspondence between upper and lower case words (and characters).

For English, u/l case comparisons are trivial. For German, there are issues.

This is what I mean about 'international' -- if the OP is writing a
locale-independent application (assumed to be the case unless indicated
otherwise), they will have to contend w/ such 'international' issues.
Jul 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2565
by: Senthoorkumaran Punniamoorthy | last post by:
I am printing these information. print string.lower(info_res) print string.lower(md5sum(f_md5)) print len(string.lower(info_res)) print len(string.lower(md5sum(f_md5))) print str(string.lower(md5sum(f_md5)) == string.lower(info_res)) and the output are
0
2264
by: Tumurbaatar S. | last post by:
Hi, I'm running MySQL 3.23.55 on WinXP and have some problem using non latin charset. I've added these 2 lines under group of my.ini: character-sets-dir = c:/mysql/share/charsets/ default-character-set=cp1251 Then restarted server and created a simple database
3
3631
by: Claude Schneegans | last post by:
Hi, I'trying to use a regExp in Javascript to replace any all upper case word in a string by the same word having only its first letter in upper case. This expression detects the words: /()(+)/g and backreferences $1 and $2 will contain the first letter and the rest of the word respectively. Now, how can I convert $2 to lower case in the replace function? I would need something like: replace(/()(+)/g, "$1" + "$2".toLowerCase())
16
5137
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. And K&R2 mentions "signed extension" everywhere. Reading some old clc posts, I've beginning to realize that these books are over-generalizing the topic. I am just wondering what the difference between the following pairs of terms are: 1)...
19
1696
by: Randy Yates | last post by:
Consider the following code: #include "dsptypes.h" /* definitions */ #define VECTOR_LENGTH 64 /* local variables */
9
2085
by: Girish | last post by:
Im trying to understand implicit type conversions from object -> string and vice versa. I have two classes, one Driver and one called StringWrapper. These are just test classes that try and emulate the pattern im trying to follow in an existing project. These are my steps: 1) I have a method "printMe" existing in the application which originally used to take in a string. This method is static and sits in the Driver
9
3135
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to be inserted into a standard web address in the table (the filed name is link) in ddw1 Example address ---
9
2794
by: B Williams | last post by:
I have written some code that will take in a string and print out the reverse, but I also want it to check for upper and lower case and swap them. Will someone assist me? include <iostream> using std::cout; using std::cin; using std::endl; #include <string>
14
43841
by: fniles | last post by:
In VB.NET 2005 can I check if a letter in a string is upper case or lower case ? For example: I have the following 2 lines: NQ,Z2003,11/11/2003,1416.5,1420,1402,1411.5 NQ,z2003,11/10/2003,223801,260154 NQ,H2004,11/11/2003,1416.5,1422.5,1406.5,1415 NQ,h2004,11/10/2003,56,1191 Notice the 1st line has uppercase Z (Z2003) and the 2nd line has lowercase z
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9566
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.