Isis 3 Programmer Reference
IString.cpp
Go to the documentation of this file.
1 
22 #include "IString.h"
23 
24 #include <algorithm>
25 #include <cmath>
26 #include <cstring>
27 #include <iomanip>
28 #include <iostream>
29 #include <sstream>
30 #include <stdio.h>
31 #include <string>
32 
33 #include <QMap>
34 #include <QObject>
35 
36 #include "IException.h"
37 #include "SpecialPixel.h"
38 
39 using namespace std;
40 
41 namespace Isis {
53  bool toBool(const QString &string) {
54  QStringList trues;
55  trues.append("true");
56  trues.append("t");
57  trues.append("yes");
58  trues.append("y");
59  trues.append("on");
60  trues.append("1");
61 
62  QStringList falses;
63  falses.append("false");
64  falses.append("f");
65  falses.append("no");
66  falses.append("n");
67  falses.append("off");
68  falses.append("0");
69 
70  bool result = true;
71  bool foundMatch = false;
72 
73  QListIterator<QString> truesIterator(trues);
74  while (!foundMatch && truesIterator.hasNext()) {
75  foundMatch = (string.compare(truesIterator.next(), Qt::CaseInsensitive) == 0);
76  }
77 
78  if (!foundMatch) {
79  result = false;
80 
81  QListIterator<QString> falsesIterator(falses);
82  while (!foundMatch && falsesIterator.hasNext()) {
83  foundMatch = (string.compare(falsesIterator.next(), Qt::CaseInsensitive) == 0);
84  }
85  }
86 
87  if (!foundMatch) {
88  qSort(trues);
89  qSort(falses);
90  QString message = QObject::tr("Failed to convert string [%1] to a boolean. "
91  "Please specify one of [%2] for true, or one of [%3] for false.")
92  .arg(string).arg(trues.join(", ")).arg(falses.join(", "));
93  throw IException(IException::Unknown, message, _FILEINFO_);
94  }
95 
96  return result;
97  }
98 
99 
108  int toInt(const QString &string) {
109  bool ok = true;
110 
111  int result = string.toInt(&ok);
112 
113  if (!ok) {
114  QString message = QObject::tr("Failed to convert string [%1] to an integer").arg(string);
115  throw IException(IException::Unknown, message, _FILEINFO_);
116  }
117 
118  return result;
119  }
120 
121 
130  BigInt toBigInt(const QString &string) {
131  BigInt result;
132 
133  try {
134  std::stringstream s;
135  s << string.toStdString(); // Put the string into a stream
136  s.seekg(0, std::ios::beg); // Move the input pointer to the beginning
137  s >> result; // read/get "type T" out of the stream
138  std::ios::iostate state = s.rdstate();
139  if((state & std::ios::failbit) || (state & std::ios::badbit) ||
140  (!(state & std::ios::eofbit))) { // Make sure the stream is empty
141  throw (int)-1;
142  }
143  }
144  catch(...) {
145  QString message = QObject::tr("Failed to convert string [%1] to a big integer").arg(string);
146  throw IException(IException::Unknown, message, _FILEINFO_);
147  }
148 
149  return result;
150  }
151 
152 
164  double toDouble(const QString &string) {
165  double result = 0.0;
166 
167  if (string.startsWith("16#") && string.endsWith("#")) {
168  try {
169  stringstream s;
170  s << string.mid(3, string.size() - 3);
171  s.seekg(0, ios::beg);
172 
173  union {
174  unsigned int intData;
175  float floatData;
176  } raw;
177 
178  s >> hex >> raw.intData;
179 
180  ios::iostate state = s.rdstate();
181  if((state & ios::failbit) || (state & ios::badbit)) {
182  throw IException();
183  }
184 
185  result = raw.floatData;
186  }
187  catch(...) {
188  QString message = QObject::tr("Failed to convert HEX string [%1] to a "
189  "double").arg(string);
190  throw IException(IException::Unknown, message, _FILEINFO_);
191  }
192  }
193  else {
194  static QMap<QString, double> knownStrings;
195  if (knownStrings.isEmpty()) {
196  // Special case: user called toDouble(toString(DBL_MAX))
197  knownStrings["1.79769313486232e+308"] = DBL_MAX;
198  knownStrings["-1.79769313486232e+308"] = -DBL_MAX;
199  }
200 
201  bool ok = true;
202  if (!knownStrings.contains(string)) {
203  result = string.toDouble(&ok);
204  }
205  else {
206  result = knownStrings[string];
207  }
208 
209  if (!ok) {
210  QString message = QObject::tr("Failed to convert string [%1] to a double").arg(string);
211  throw IException(IException::Unknown, message, _FILEINFO_);
212  }
213  }
214 
215  return result;
216  }
217 
218 
226  QString toString(bool boolToConvert) {
227  return boolToConvert? "Yes" : "No";
228  }
229 
230 
239  QString toString(char charToConvert) {
240  QString result;
241  result += QChar(charToConvert);
242  return result;
243  }
244 
245 
252  QString toString(const int &intToConvert) {
253  return QString::number(intToConvert);
254  }
255 
256 
263  QString toString(const unsigned int &intToConvert) {
264  return QString::number(intToConvert);
265  }
266 
267 
274  QString toString(const BigInt &intToConvert) {
275  return QString::number(intToConvert);
276  }
277 
278 
292  QString toString(double doubleToConvert, int precision) {
293  // If number is zero, then it is not valid to do a log10 on it. To avoid this,
294  // check for zero ahead of time and handle it.
295  QString result;
296 
297  if(doubleToConvert == 0.0) {
298  result = "0.0";
299  }
300  else if (std::isnan(doubleToConvert) ) {
301  result = "nan";
302  }
303 
304  if(doubleToConvert > DBL_MAX) {
305  doubleToConvert = DBL_MAX;
306  }
307 
308  if(doubleToConvert < -DBL_MAX) {
309  doubleToConvert = -DBL_MAX;
310  }
311 
312  if (result == "") {
313  // First determine the number of digits preceding the decimal point
314  // Numbers of the form 0.ABCDEFG where A is non-zero are assumed to
315  // have a leading digit of zero. Numbers of the form 0.0ABCDEFG,
316  // 0.00ABCEFEG and so on are not considered to have a leading digit
317  // (pre = 0).
318  double temp = qAbs(doubleToConvert);
319  int pre = (int)(log10(temp)) + 1;
320 
321  // If preceding number of digits is too large then we will need to create a
322  // scientific notation string. We will need 14 spaces for numbers, 2 spaces
323  // for exponents, 2 spaces for signs, and 1 for the letter E, 1 for a decimal
324  // place, and 1 extra in case of a leading 0. A grand total
325  // of 21 spaces is required. Therefore our format can be %22e
326 
327  // If the preceding number of digits is zero then we likely have a
328  // really small number (e.g., 0.000331236236). So let's put those in
329  // scientific notation as well
330 
331  // Finally, remove any zeroes before the E and if the exponent is zero
332  // then strip it off as well.
333 
334  char doubleString[23];
335 
336  if((log10(temp) > 13.0) || (log10(temp) < -3.0)) {
337  char format[8], buffer[8];
338  snprintf(buffer, 8, "%de", precision);
339  strcpy(format, "%21.");
340  strcat(format, buffer);
341  snprintf(doubleString, 23, format, doubleToConvert);
342 
343  char *e = strchr(doubleString, 'e');
344  char *sptr = e - 1;
345 
346  while(*sptr == '0') {
347  sptr--;
348  }
349 
350  if(*sptr == '.') {
351  sptr++;
352  }
353 
354  sptr++;
355  char tmp[22];
356  strcpy(tmp, e);
357  strcpy(sptr, tmp);
358 
359  e = strchr(doubleString, 'e');
360  int allzero = 1;
361 
362  for(sptr = e + 2; *sptr; sptr++) {
363  if(*sptr != '0') {
364  allzero = 0;
365  }
366  }
367 
368  if(allzero) {
369  *e = 0;
370  }
371  }
372  else {
373  // Ok it can be presented as a normal floating point num. So we will need
374  // 14 spaces for nums, 1 for the sign, 1 for the decimal, and 1 more
375  // for a possible leading 0. A grand total of 17 spaces. Therefore our
376  // format can be "%17.postf". Finally remove any trailing zeroes.
377 
378  if(temp < 1.0) {
379  pre--;
380  }
381  int post = precision - pre;
382 
383  char tempStr[3], format[8];
384  strcpy(format, "%17.");
385  snprintf(tempStr, 3, "%d", post);
386  strcat(format, tempStr);
387  strcat(format, "f");
388 
389  snprintf(doubleString, 23, format, doubleToConvert);
390 
391  if(post > 0) {
392  char *sptr = doubleString + strlen(doubleString) - 1;
393  while((*sptr == '0') && (*(sptr - 1) != '.')) {
394  *sptr = 0;
395  sptr--;
396  }
397  }
398  }
399 
400  while(doubleString[0] == ' ') {
401  for(unsigned int i = 0; i < strlen(doubleString); i++) {
402  doubleString[i] = doubleString[i + 1];
403  }
404  }
405 
406  result = QString(doubleString);
407  }
408 
409  return result;
410  }
411 
412 
418  IString::IString() : string() {
419  }
420 
429  IString::IString(const std::string &str) : string(str) {
430  }
431 
439  IString::IString(const IString &str) : string(str) {
440  }
441 
449  IString::IString(const char *str) : string(str) {
450  }
451 
461  IString::IString(const int &num) : string() {
462  ostringstream str;
463  str << num;
464  assign(str.str());
465  }
466 
476  IString::IString(const BigInt &num) : string() {
477  ostringstream str;
478  str << num;
479  assign(str.str());
480  }
481 
496  IString::IString(const double &num, const int piPrecision) : string() {
497  SetDouble(num, piPrecision);
498  }
499 
500 
509  void IString::SetDouble(const double &num, const int piPrecision) {
510  *this = toString(num, piPrecision).toStdString();
511  }
512 
519  IString::IString(const QString &str) : string() {
520  assign(str.toStdString());
521  }
522 
529 
540  IString IString::Trim(const std::string &chars) {
541  TrimHead(chars);
542  TrimTail(chars);
543  return *this;
544  }
545 
559  std::string IString::Trim(const std::string &chars, const std::string &str) {
560  //string result = str;
561  //result.replace (0,str.find_first_not_of (chars), "");
562  return TrimTail(chars, TrimHead(chars, str));
563  }
564 
573  IString IString::TrimHead(const std::string &chars) {
574  *this = replace(0, find_first_not_of(chars), "");
575  return *this;
576  }
577 
588  std::string IString::TrimHead(const std::string &chars, const std::string &str) {
589  string result = str;
590  result.replace(0, str.find_first_not_of(chars), "");
591  return result;
592  }
593 
602  IString IString::TrimTail(const std::string &chars) {
603  *this = erase(find_last_not_of(chars) + 1);
604  return *this;
605  }
606 
619  std::string IString::TrimTail(const std::string &chars, const std::string &str) {
620  string result = str;
621  result.erase(str.find_last_not_of(chars) + 1);
622  return result;
623  }
624 
633  string temp = *this;
634  *this = UpCase(temp);
635  return *this;
636  }
637 
647  std::string IString::UpCase(const std::string &str) {
648  string sOut(str);
649  transform(str.begin(), str.end(), sOut.begin(), (int ( *)(int)) toupper);
650  return(sOut);
651  }
652 
660  *this = DownCase((string) * this);
661  return *this;
662  }
663 
674  std::string IString::DownCase(const std::string &str) {
675  string sOut(str);
676  transform(str.begin(), str.end(), sOut.begin(), (int ( *)(int))tolower);
677  return sOut;
678  }
679 
692  static bool nocase_compare(const char c1, const char c2) {
693  return(toupper(c1) == toupper(c2));
694  }
695 
705  bool IString::Equal(const std::string &str) const {
706  string temp = *this;
707  return Equal(str, temp);
708  }
709 
720  bool IString::Equal(const std::string &str1, const std::string &str2) {
721  if(str1.size() != str2.size()) return(false);
722  return(std::equal(str1.begin(), str1.end(), str2.begin(), nocase_compare));
723  }
724 
725 
733  int IString::ToInteger() const {
734  return ToInteger(*this);
735  }
736 
746  int IString::ToInteger(const std::string &str) {
747  int v_out;
748  try {
749  stringstream s;
750  s << str; // Put the string into a stream
751  s.seekg(0, ios::beg); // Move the input pointer to the beginning
752  s >> v_out; // read/get "type T" out of the stream
753  ios::iostate state = s.rdstate();
754  if((state & ios::failbit) || (state & ios::badbit) ||
755  (!(state & ios::eofbit))) { // Make sure the stream is empty
756  throw(int) - 1;
757  }
758  }
759  catch(...) {
760  string message = "Failed to convert string [" + str + "] to an integer";
761  throw IException(IException::Unknown, message, _FILEINFO_);
762  }
763  return(v_out);
764  }
765 
774  return ToBigInteger(*this);
775  }
776 
786  BigInt IString::ToBigInteger(const std::string &str) {
787  BigInt v_out;
788  try {
789  stringstream s;
790  s << str; // Put the string into a stream
791  s.seekg(0, ios::beg); // Move the input pointer to the beginning
792  s >> v_out; // read/get "type T" out of the stream
793  ios::iostate state = s.rdstate();
794  if((state & ios::failbit) || (state & ios::badbit) ||
795  (!(state & ios::eofbit))) { // Make sure the stream is empty
796  throw(int) - 1;
797  }
798  }
799  catch(...) {
800  string message = "Failed to convert string [" + str + "] to a big "
801  "integer";
802  throw IException(IException::Unknown, message, _FILEINFO_);
803  }
804  return(v_out);
805  }
806 
814  double IString::ToDouble() const {
815  return ToDouble(*this);
816  }
817 
827  double IString::ToDouble(const std::string &str) {
828 
829  double v_out;
830 
831  // Convert a hex value
832  if(str.substr(0, 3) == "16#" && str.substr(str.length() - 1, 1) == "#") {
833  try {
834  stringstream s;
835  s << str.substr(3, str.find_last_of("#") - 3);
836  s.seekg(0, ios::beg);
837 
838  union {
839  unsigned int i;
840  float f;
841  } u;
842 
843  s >> hex >> u.i;
844 
845  ios::iostate state = s.rdstate();
846  if((state & ios::failbit) || (state & ios::badbit)) {
847  throw(int) - 1;
848  }
849  v_out = u.f;
850  }
851  catch(...) {
852  string message = "Failed to convert HEX string [" + str + "] to a "
853  "double";
854  throw IException(IException::Unknown, message, _FILEINFO_);
855  }
856  }
857  // Convert a decimal value
858  else {
859  try {
860  stringstream s;
861  s << str; // Put the string into a stream
862  s.seekg(0, ios::beg); // Move the input pointer to the beginning
863  s >> v_out; // read/get "type T" out of the stream
864  ios::iostate state = s.rdstate();
865  if((state & ios::failbit) || (state & ios::badbit) ||
866  (!(state & ios::eofbit))) { // Make sure the stream is empty
867  throw(int) - 1;
868  }
869  }
870  catch(...) {
871  string message = "Failed to convert string [" + str + "] to a double";
872  throw IException(IException::Unknown, message, _FILEINFO_);
873  }
874  }
875 
876  return(v_out);
877  }
878 
884  QString IString::ToQt() const {
885  return QString::fromStdString(*this);
886  }
887 
895  QString IString::ToQt(const std::string &s) {
896  return(QString::fromStdString(s));
897  }
898 
912  IString IString::Token(const IString &separator) {
913  IString retstr = "" ;
914 
915  for(unsigned int i = 0; i < size(); i++) {
916  for(unsigned int sep = 0; sep < separator.size(); sep++) {
917  if(separator[sep] == at(i)) {
918  retstr = substr(0, i);
919  replace(0, i + 1, "");
920  return retstr;
921  }
922  }
923  }
924 
925  if(retstr == "") {
926  retstr = (*this);
927  replace(0, size(), "");
928  }
929 
930  return retstr;
931  }
932 
955  int IString::Split(const char separator, const std::string &str,
956  std::vector<std::string> &tokens,
957  bool allowEmptyEntries) {
958  string::size_type idx(0), idx2(0);
959  unsigned int ksize = str.size();
960  tokens.clear();
961 
962  if(ksize > 0) {
963  if(str[idx] == separator) idx++;
964  while((idx2 = str.find(separator, idx)) != string::npos) {
965  if(idx2 == idx) {
966  if(allowEmptyEntries) tokens.push_back("");
967  }
968  else {
969  string::size_type len(idx2 - idx);
970  tokens.push_back(str.substr(idx, len));
971  }
972  idx = idx2 + 1;
973  }
974  if(idx < ksize) tokens.push_back(str.substr(idx));
975  }
976  return(tokens.size());
977  }
978 
979 
990  *this = Compress((string) * this, force);
991  return *this;
992  }
993 
1005  std::string IString::Compress(const std::string &str, bool force) {
1006  string result(str);
1007  if(force == false) {
1008  int spaces = 0;
1009  int leftquote = result.find_first_of("\"\'");
1010  while((spaces = result.find(" ", spaces)) >= 0) {
1011  int rightquote = result.find_first_of("\"\'", leftquote + 1);
1012  if(spaces < leftquote) { //spaces are before quotation
1013  result.erase(spaces, 1);
1014  leftquote = result.find_first_of("\"\'", spaces);
1015  }
1016  else if((spaces > leftquote) && (spaces < rightquote)) { //spaces are within quotation
1017  spaces = rightquote + 1;
1018  leftquote = result.find_first_of("\"\'", rightquote + 1);
1019  }
1020  else if(leftquote == (int)npos) { //there are no quotations
1021  result.erase(spaces, 1);
1022  }
1023  else { //spaces are after quotation
1024  leftquote = result.find_first_of("\"\'", rightquote + 1);
1025  }
1026  }
1027  return result;
1028  }
1029  else {
1030  int spaces = 0;
1031  while((spaces = result.find(" ", spaces)) >= 0) {
1032  result.erase(spaces, 1);
1033  }
1034  return result;
1035  }
1036  }
1037 
1052  IString IString::Replace(const std::string &from, const std::string &to,
1053  int maxReplaceCount) {
1054  *this = IString(Replace((string) * this, from, to, maxReplaceCount));
1055  return *this;
1056  }
1057 
1106  std::string IString::Replace(const std::string &str, const std::string &from,
1107  const std::string &to, int maxReplaceCount) {
1108  if(str.empty()) return(str);
1109  if(from.empty()) return(str);
1110  string sRet(str);
1111  string::size_type pos;
1112  int nReplaced = 0;
1113  while((nReplaced < maxReplaceCount) &&
1114  (pos = sRet.find(from)) != string::npos) {
1115  sRet.replace(pos, from.size(), to);
1116  nReplaced++;
1117  }
1118  return(sRet);
1119  }
1120 
1121 
1138  IString IString::Replace(const std::string &from, const std::string &to,
1139  bool honorquotes) {
1140  *this = Replace((string) * this, from, to, honorquotes);
1141  return *this;
1142  }
1143 
1162  IString IString::Replace(const std::string &str, const std::string &from,
1163  const std::string &to , bool honorquotes) {
1164 
1165  string result = str;
1166  if(honorquotes == true) {
1167  int instances = 0;
1168  int quote = result.find_first_of("\"\'");
1169  while((instances = result.find(from, instances)) >= 0) {
1170 
1171  int nextquote = result.find_first_of("\"\'", quote + 1);
1172  if(instances < quote) {
1173  result.replace(instances, from.length(), to);
1174  quote = result.find_first_of("\"\'", instances);
1175  }
1176  else if((instances > quote) && (instances < nextquote)) {
1177  instances = nextquote + 1;
1178  quote = result.find_first_of("\"\'", nextquote);
1179  }
1180  else if(quote == (int)npos) {
1181  result.replace(instances, from.length(), to);
1182  }
1183  else {
1184  quote = result.find_first_of("\"\'", nextquote);
1185  }
1186  }
1187  return (IString) result;
1188  }
1189  else {
1190  int instances = 0;
1191  while((instances = result.find(from, instances)) >= 0) {
1192  result.replace(instances, from.length(), to);
1193  }
1194  return (IString) result;
1195  }
1196  }
1197 
1211  IString IString::Convert(const std::string &listofchars, const char &to) {
1212  *this = Convert((string) * this, listofchars, to);
1213  return *this;
1214  }
1215 
1231  string IString::Convert(const std::string &str, const std::string &listofchars,
1232  const char &to) {
1233  std::string::size_type pos = 0;
1234  string result = str;
1235  string tmp;
1236  tmp = to;
1237  while((pos = result.find_first_of(listofchars, pos)) != npos) {
1238  result.replace(pos, 1, tmp);
1239  pos++;
1240  }
1241  return result;
1242  }
1243 
1254  *this = ConvertWhiteSpace((string) * this);
1255  return *this;
1256  }
1257 
1267  std::string IString::ConvertWhiteSpace(const std::string &str) {
1268  return Convert(str, "\n\r\t\f\v\b", ' ');
1269  }
1270 
1281  IString IString::Remove(const std::string &del) {
1282  std::string::size_type pos;
1283  while((pos = find_first_of(del)) != npos) this->erase(pos, 1);
1284  return *this;
1285  }
1286 
1300  std::string IString::Remove(const std::string &str, const std::string &del) {
1301  string::size_type pos;
1302  string result(str);
1303  while((pos = result.find_first_of(del)) != npos) result.erase(pos, 1);
1304  return result;
1305  }
1306 
1316  IString &IString::operator= (const int &value) {
1317  ostringstream str;
1318  str << value;
1319  assign(str.str());
1320  return *this;
1321  }
1322 
1333  ostringstream str;
1334  str << value;
1335  assign(str.str());
1336  return *this;
1337  }
1338 
1348  std::string IString::ToStd(const QString &str) {
1349  return(str.toStdString());
1350  }
1351 
1361  QStringList IString::ToQt(const std::vector<std::string> &sl) {
1362  QStringList Qsl;
1363  for(unsigned int i = 0 ; i < sl.size() ; i++) {
1364  Qsl << ToQt(sl[i]);
1365  }
1366  return Qsl;
1367  }
1368 
1378  std::vector<std::string> IString::ToStd(const QStringList &sl) {
1379  std::vector<std::string> Stdsl;
1380  for(int i = 0 ; i < sl.size() ; i++) {
1381  Stdsl.push_back(ToStd(sl.at(i)));
1382  }
1383 
1384  return(Stdsl);
1385  }
1386 
1387 
1399  std::ostream &operator<<(std::ostream &outputStream, const QString &string) {
1400  return (outputStream << string.toLatin1().data());
1401  }
1402 
1403 
1415  std::ostream &operator<<(std::ostream &outputStream, const QStringRef &string) {
1416  return (outputStream << string.toString().toLatin1().data());
1417  }
1418 }
long long int BigInt
Big int.
Definition: Constants.h:65
IString()
Constructs an empty IString object.
Definition: IString.cpp:418
static std::string ToStd(const QString &str)
Converts a Qt string into a std::string.
Definition: IString.cpp:1348
double ToDouble() const
Returns the floating point value the IString represents.
Definition: IString.cpp:814
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:108
Namespace for the standard library.
IString & operator=(const int &value)
Attempts to convert the stirng to a QStirng (Qt) and return that IString.
Definition: IString.cpp:1316
IString TrimHead(const std::string &chars)
Trims The input characters from the beginning of the object IString.
Definition: IString.cpp:573
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
int ToInteger() const
Returns the object string as an integer.
Definition: IString.cpp:733
static int Split(const char separator, const std::string &instr, std::vector< std::string > &tokens, bool allowEmptyEntries=true)
Find separators between characters and split them into strings.
Definition: IString.cpp:955
BigInt toBigInt(const QString &string)
Global function to convert from a string to a "big" integer.
Definition: IString.cpp:130
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
static bool nocase_compare(const char c1, const char c2)
Compare two characters without regard to case.
Definition: IString.cpp:692
IString Compress(bool force=false)
Collapses multiple spaces into single spaces.
Definition: IString.cpp:989
IString Token(const IString &separator)
Returns the first token in the IString.
Definition: IString.cpp:912
QString toString(double doubleToConvert, int precision)
Global function to convert a double to a string with the given precision (significant figures)...
Definition: IString.cpp:292
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
IString Convert(const std::string &listofchars, const char &to)
Returns the string with all occurrences of any character in the "from" argument converted to the "to"...
Definition: IString.cpp:1211
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:134
QString ToQt() const
Retuns the object string as a QString.
Definition: IString.cpp:884
IString Remove(const std::string &del)
Remove all instances of any character in the string from the IString.
Definition: IString.cpp:1281
~IString()
Destructor.
Definition: IString.cpp:528
IString DownCase()
Converts all upper case letters in the object IString into lower case characters. ...
Definition: IString.cpp:659
void SetDouble(const double &value, const int piPrecision=14)
Performs the conversion necessary to represent a floating-point value as a string.
Definition: IString.cpp:509
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
Definition: IString.cpp:53
bool Equal(const std::string &str) const
Compare a string to the object IString.
Definition: IString.cpp:705
IString Replace(const std::string &from, const std::string &to, int maxReplaceCount=20)
Replaces all instances of the first input string with the second input string.
Definition: IString.cpp:1052
Isis exception class.
Definition: IException.h:107
Adds specific functionality to C++ strings.
Definition: IString.h:181
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
IString ConvertWhiteSpace()
Returns the string with all "new lines", "carriage returns", "tabs", "form feeds", "vertical tabs" and "back spaces" converted to single spaces.
Definition: IString.cpp:1253
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:308
IString UpCase()
Converst any lower case characters in the object IString with uppercase characters.
Definition: IString.cpp:632
BigInt ToBigInteger() const
Returns the BigInt representation of the object IString.
Definition: IString.cpp:773
IString TrimTail(const std::string &chars)
Trims the input characters from the end of the object IString.
Definition: IString.cpp:602
IString Trim(const std::string &chars)
Removes characters from the beginning and end of the IString.
Definition: IString.cpp:540