File indexing completed on 2024-04-28 15:35:16
0001 /*************************************************************************** 0002 * Copyright (C) 2004 by Tomas Mecir * 0003 * kmuddy@kmuddy.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU Library General Public License as * 0007 * published by the Free Software Foundation; either version 2 of the * 0008 * License, or (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU Library General Public License for more details. * 0014 ***************************************************************************/ 0015 0016 #include "stringops.h" 0017 0018 #include <ctype.h> 0019 0020 using namespace std; 0021 0022 std::string lcase (const std::string &str) 0023 { 0024 string s; 0025 int len = str.length(); 0026 for (int i = 0; i < len; i++) 0027 s.push_back (tolower (str[i])); 0028 return s; 0029 } 0030 0031 std::string ucase (const std::string &str) 0032 { 0033 string s; 0034 int len = str.length(); 0035 for (int i = 0; i < len; i++) 0036 s.push_back (toupper (str[i])); 0037 return s; 0038 } 0039 0040 std::string firstword (const std::string &str) 0041 { 0042 int pos = str.find (" "); 0043 return str.substr (0, pos); 0044 }