|
Boost Users : |
From: dizzy (dizzy_at_[hidden])
Date: 2008-06-10 10:38:33
On Tuesday 10 June 2008 15:56:05 brad_at_[hidden] wrote:
> I've looked through the documentation and Googled, but I cannot find any
> info on
> the topic. If I want to find a file named 'System.dll', but on some
> systems the file is named 'system.DLL' or 'SYSTEM.DLL', etc. If I
> could could do something like this:
>
> if (boost::filesystem::is_regular(itr->path()))
> {
> std::cout << itr->path().lower() << std::endl;
> }
>
> Notice the .lower() In this way, each path would be lowercase and I
> could search for only 'system.dll' and .lower() would find any occurrence
> of that filename, no matter the case.
>
> I wonder how others do this today? Do you use transform or tolower from
> another library?
I don't understand the question, can't you use std::tolower (from <cctype>) ?
To compare strings in case insensitive ways using a common case is an
acceptable solution. This is a problem when using locales for which this
cunversion is not bidirectional (I understand in Greek there are 2 different
lower case characters that uppercase is the same character thus using the
std::tolower aproach you would get false negatives in some situations).
-- Mihai RUSU Email: dizzy_at_[hidden] "Linux is obsolete" -- AST
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net