/[projects]/smsdaemon/Util.cpp
ViewVC logotype

Diff of /smsdaemon/Util.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 151 by torben, Mon Dec 8 10:42:04 2008 UTC revision 185 by torben, Mon Dec 15 09:10:05 2008 UTC
# Line 13  Line 13 
13  #include <stdlib.h>  #include <stdlib.h>
14    
15  #include <cstring>  #include <cstring>
16  #include "util.h"  #include "Util.h"
17    
18  using namespace std;  using namespace std;
19    
# Line 146  namespace Util Line 146  namespace Util
146                  return str;                  return str;
147          }          }
148    
149    
150            vector<string>  str_split(string input)
151            {
152                    string buf;
153                    stringstream ss(input);
154                    vector<string> tokens;
155                    while (ss >> buf)
156                            tokens.push_back(buf);
157                    return tokens;
158            }
159    
160    
161          vector<string> str_split(string input, string delimiter)          vector<string> str_split(string input, string delimiter)
162          {          {
163                  vector<string> retval;                  vector<string> retval;
# Line 168  namespace Util Line 180  namespace Util
180                  return retval;                  return retval;
181          }          }
182    
183          char my_toupper(char ch)          char danish_map[3][2] = { {198,230}, {216,248}, {197,229} }; // aelig, oslash, aring
184    
185            unsigned char my_toupper(unsigned char ch)
186          {          {
187                  if (ch == 'æ')                  if (ch == 230)
188                          return 'Æ';                          return 198;
189                  if (ch == 'ø')                  if (ch == 248)
190                          return 'Ø';                          return 216;
191                  if (ch == 'å')                  if (ch == 229)
192                          return 'Å';                          return 197;
193    
194                  return ::toupper(ch);                  return ::toupper(ch);
195          }          }
196    
197          char my_tolower(char ch)          unsigned char my_tolower(unsigned char ch)
198          {          {
199                  if (ch == 'Æ')                  if (ch == 198)
200                          return 'æ';                          return 230;
201                  if (ch == 'Ø')                  if (ch == 216)
202                          return 'ø';                          return 248;
203                  if (ch == 'Å')                  if (ch == 197)
204                          return 'å';                          return 229;
205    
206                  return ::tolower(ch);                  return ::tolower(ch);
207          }          }

Legend:
Removed from v.151  
changed lines
  Added in v.185

  ViewVC Help
Powered by ViewVC 1.1.20