00001 /** 00002 \file Robots/LoBot/util/LoString.C 00003 \brief String functions. 00004 */ 00005 00006 // //////////////////////////////////////////////////////////////////// // 00007 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00008 // by the University of Southern California (USC) and the iLab at USC. // 00009 // See http://iLab.usc.edu for information about this project. // 00010 // //////////////////////////////////////////////////////////////////// // 00011 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00012 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00013 // in Visual Environments, and Applications'' by Christof Koch and // 00014 // Laurent Itti, California Institute of Technology, 2001 (patent // 00015 // pending; application number 09/912,225 filed July 23, 2001; see // 00016 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00017 // //////////////////////////////////////////////////////////////////// // 00018 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00019 // // 00020 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00021 // redistribute it and/or modify it under the terms of the GNU General // 00022 // Public License as published by the Free Software Foundation; either // 00023 // version 2 of the License, or (at your option) any later version. // 00024 // // 00025 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00026 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00027 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00028 // PURPOSE. See the GNU General Public License for more details. // 00029 // // 00030 // You should have received a copy of the GNU General Public License // 00031 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00032 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00033 // Boston, MA 02111-1307 USA. // 00034 // //////////////////////////////////////////////////////////////////// // 00035 // 00036 // Primary maintainer for this file: mviswana usc edu 00037 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/util/LoString.C $ 00038 // $Id: LoString.C 13037 2010-03-23 01:00:53Z mviswana $ 00039 // 00040 00041 //------------------------------ HEADERS -------------------------------- 00042 00043 // lobot headers 00044 #include "Robots/LoBot/util/LoString.H" 00045 00046 // Standard C++ headers 00047 #include <algorithm> 00048 #include <cctype> 00049 00050 //----------------------------- NAMESPACE ------------------------------- 00051 00052 namespace lobot { 00053 00054 //------------------------ STRING MANIPULATION -------------------------- 00055 00056 // Convert strings to upper and lower case 00057 std::string upstring(std::string s) 00058 { 00059 typedef int (*case_converter)(int) ; // for disambiguation 00060 std::transform(s.begin(), s.end(), s.begin(), 00061 static_cast<case_converter>(std::toupper)) ; 00062 return s ; 00063 } 00064 00065 std::string downstring(std::string s) 00066 { 00067 typedef int (*case_converter)(int) ; // for disambiguation 00068 std::transform(s.begin(), s.end(), s.begin(), 00069 static_cast<case_converter>(std::tolower)) ; 00070 return s ; 00071 } 00072 00073 std::string dup_string(const std::string& s, int n) 00074 { 00075 std::string ret(s) ; 00076 while (--n > 0) 00077 ret += s ; 00078 return ret ; 00079 } 00080 00081 //----------------------------------------------------------------------- 00082 00083 } // end of namespace encapsulating this file's definitions 00084 00085 /* So things look consistent in everyone's emacs... */ 00086 /* Local Variables: */ 00087 /* indent-tabs-mode: nil */ 00088 /* End: */