diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-10-02 15:44:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-10-02 15:44:00 +0000 |
commit | 8f7aa040f7d8e9904c93929bcac1ed0a3a7e2f41 (patch) | |
tree | f708e9263fd7cdaa09185cf3703c35499b686262 | |
parent | b2d08a44b423ce9349b482e4c55ab613729c5d7d (diff) |
slightly improved string_is_affirmative() implementation
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5722 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/utils.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 57500586a3..8fd5ca499f 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -581,25 +581,21 @@ ARDOUR::auto_style_to_string (AutoStyle as) /*NOTREACHED*/ return ""; } - bool string_is_affirmative (const std::string& str) { /* to be used only with XML data - not intended to handle user input */ - if (str.length() == 1) { - if (str[0] == '1' || str[0] == 'y' || str[0] == 'Y') { - return true; - } else { - return false; - } + if (str == "1" || str == "y" || str == "Y") { + return true; } else { - if (str == "yes" || str == "Yes" || str == "YES") { + std::string str_uc; + std::transform(str.begin(), str.end(), str_uc.begin(), ::toupper); + if (str_uc == "YES") { return true; - } else { - return false; } } + return false; } extern "C" { |