#include <cassert>
#include <sstream>
#include <string>
#include "Util_String.hh"
Include dependency graph for Util_String.cc:

Go to the source code of this file.
Functions | |
| string | Hex (int i) |
| double | string_to_double (const string &s) |
| string | double_to_string (double d) |
| string | int_to_string (int i) |
| int | string_to_int (const string &s) |
| string | leftPad (unsigned int size, string input) |
| string | myFormat (unsigned int size, int m) |
| string | myFormat (unsigned int size, double x) |
|
|
Definition at line 30 of file Util_String.cc. Referenced by myFormat().
00031 {
00032 stringstream ss;
00033 ss << d;
00034 return ss.str();
00035 }
|
|
|
Definition at line 11 of file Util_String.cc.
00011 {
00012 stringstream ss;
00013 ss.setf(ios::hex, ios::basefield);
00014 ss << i;
00015
00016 string out;
00017 ss >> out;
00018 return out;
00019 }
|
|
|
Definition at line 37 of file Util_String.cc. Referenced by myFormat().
00038 {
00039 stringstream ss;
00040 ss << i;
00041 return ss.str();
00042 }
|
|
||||||||||||
|
Definition at line 53 of file Util_String.cc. Referenced by myFormat().
00053 {
00054 unsigned int len = input.length();
00055 assert( len <= size );
00056
00057 // create output string
00058 char* ch = new char[size-len+1];
00059 // left pad it with spaces
00060 for(unsigned int i=0; i<size-len; i++) ch[i]=' ';
00061 ch[size-len]='\0';
00062
00063 // concatenate input string
00064 string str(ch);
00065 str += input;
00066 return str;
00067 }
|
|
||||||||||||
|
Definition at line 73 of file Util_String.cc. References double_to_string(), and leftPad(). Referenced by LCDG4EventAction::EndOfEventAction(), and LCDG4readStdFile::GeneratePrimaryVertex().
00073 {
00074 return leftPad(size,double_to_string(x));
00075 }
|
|
||||||||||||
|
Definition at line 69 of file Util_String.cc. References int_to_string(), and leftPad().
00069 {
00070 return leftPad(size,int_to_string(m));
00071 }
|
|
|
Definition at line 21 of file Util_String.cc.
00022 {
00023 stringstream ss;
00024 double d;
00025 ss << s;
00026 ss >> d;
00027 return d;
00028 }
|
|
|
Definition at line 44 of file Util_String.cc.
00045 {
00046 stringstream ss;
00047 int i;
00048 ss << s;
00049 ss >> i;
00050 return i;
00051 }
|
1.3.4