| | |
->ToLower() (Mixing letters and numbers)
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Oct 2008
Posts: 122
Reputation:
Solved Threads: 6
I use this command to check for the Computername wich returns:
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:
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...
C++ Syntax (Toggle Plain Text)
SystemInformation::ComputerName->ToString(); //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:
C++ Syntax (Toggle Plain Text)
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...
•
•
Join Date: Sep 2008
Posts: 1,657
Reputation:
Solved Threads: 206
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?
See also ToLowerInvariant() function:
http://msdn.microsoft.com/en-us/libr...invariant.aspx.
MS recommends ToLowerInvariant for OS identifiers (file names, registry keys etc)...
http://msdn.microsoft.com/en-us/libr...invariant.aspx.
MS recommends ToLowerInvariant for OS identifiers (file names, registry keys etc)...
•
•
Join Date: Oct 2008
Posts: 122
Reputation:
Solved Threads: 6
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.
•
•
•
•
See also ToLowerInvariant() function:
http://msdn.microsoft.com/en-us/libr...invariant.aspx.
MS recommends ToLowerInvariant for OS identifiers (file names, registry keys etc)...
![]() |
Similar Threads
- Letters, numbers and print numbers on the screen (C++)
- Validate A String That Has 2 Letters and Then 6 Numbers (C++)
- Textbox allows letters and numbers only (Visual Basic 4 / 5 / 6)
- random letters/numbers (Visual Basic 4 / 5 / 6)
- 3 letters or numbers com/net/org/info/biz/us -or- YPN invite [wanted] (Websites for Sale)
Other Threads in the C++ Forum
- Previous Thread: Input stream for Point class
- Next Thread: Looking for best practices and naming conventions
Views: 414 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






