->ToLower() (Mixing letters and numbers)

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2008
Posts: 122
Reputation: Liszt is an unknown quantity at this point 
Solved Threads: 6
Liszt Liszt is offline Offline
Junior Poster

->ToLower() (Mixing letters and numbers)

 
0
  #1
May 14th, 2009
I use this command to check for the Computername wich returns:
  1. SystemInformation::ComputerName->ToString();
  2. //returns: MYCOMP-EG03R8F

When manually rightclicking "My Computer" and check what name I have, it says with lowcase letters:

mycomp-eg03r8f

So it doesn´t return the correct name. It shows Capitals.

But if I do this command instead:
  1. SystemInformation::ComputerName->ToLower()->ToString();

I do get the same computername:

mycomp-eg03r8f


Is it okay to use ->ToLower() when it is a mix with letters and numbers. The function is intelligent and separates letters from numbers ?

Thank you if someone can confirm that...
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,627
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 205
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: ->ToLower() (Mixing letters and numbers)

 
0
  #2
May 14th, 2009
Judging by the fact that you got the expected output, and not an error, it seems like a safe assumption, doesn't it? If you're concerned about it, run some tests on varying inputs. You'll probably find that it works fine. My guess is that the toLower() function uses the ASCII table to verify that something is a letter and acts appropriately (there are plenty of symbols that aren't letters OR numbers). Also, are you sure you can't look at the function's code yourself, by looking in some standard library?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: ->ToLower() (Mixing letters and numbers)

 
0
  #3
May 15th, 2009
See also ToLowerInvariant() function:
http://msdn.microsoft.com/en-us/libr...invariant.aspx.
MS recommends ToLowerInvariant for OS identifiers (file names, registry keys etc)...
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 122
Reputation: Liszt is an unknown quantity at this point 
Solved Threads: 6
Liszt Liszt is offline Offline
Junior Poster

Re: ->ToLower() (Mixing letters and numbers)

 
0
  #4
May 15th, 2009
thank you ArkM, I thought of that perheps can be a scenario that I haven´t thought about. I red about the ToLowerInvariant() and it seems to be the right approach for this purpose.

Originally Posted by ArkM View Post
See also ToLowerInvariant() function:
http://msdn.microsoft.com/en-us/libr...invariant.aspx.
MS recommends ToLowerInvariant for OS identifiers (file names, registry keys etc)...
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC