1 |
/** |
2 |
* @file StringUtils.hpp |
3 |
* @author Dan Gezelter |
4 |
* @date 10/18/2004 |
5 |
* @version 1.0 |
6 |
*/ |
7 |
|
8 |
#ifndef UTILS_STRINGUTILS_HPP |
9 |
#define UTILS_STRINGUTILS_HPP |
10 |
#include <string> |
11 |
#include <iostream> |
12 |
#include <fstream> |
13 |
|
14 |
namespace oopse { |
15 |
|
16 |
using namespace std; |
17 |
|
18 |
|
19 |
/** |
20 |
* Converts a string to UPPER CASE |
21 |
* @param S |
22 |
*/ |
23 |
string UpperCase(const string& S); |
24 |
|
25 |
/** |
26 |
* Converts a string to lower case |
27 |
* @param S |
28 |
*/ |
29 |
string LowerCase(const string& S); |
30 |
|
31 |
/** |
32 |
* Removes left and right spaces from a string |
33 |
* |
34 |
* @param str String to trim |
35 |
* |
36 |
* @return char* to the trimed string |
37 |
*/ |
38 |
char* trimSpaces(char *str); |
39 |
|
40 |
/** |
41 |
* Finds the location of the string "begin <startText>" in an input stream. |
42 |
* @param theStream |
43 |
* @param startText |
44 |
* |
45 |
* @return the line number of the block within the theStream |
46 |
*/ |
47 |
int findBegin(istream &theStream, char* startText ); |
48 |
|
49 |
/** |
50 |
* Counts the number of tokens on line which are delimited by the characters |
51 |
* listed in delimiters |
52 |
* @param line |
53 |
* @param delimiters |
54 |
*/ |
55 |
int countTokens(char *line, char *delimiters); |
56 |
|
57 |
/** |
58 |
* discovers whether or not the line contains the "end" token |
59 |
* |
60 |
* @param line The line to test |
61 |
* |
62 |
* @return int (==1 if the line has "end", ==0 if not). |
63 |
*/ |
64 |
int isEndLine(char *line); |
65 |
|
66 |
} |
67 |
|
68 |
#endif |