BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
bes::String Namespace Reference

Functions

void lowerCh (char &c)
void upperCh (char &c)
void transformToLower (std::string &str)
void transformToUpper (std::string &str)
std::string toLower (const std::string &str)
std::string toUpper (const std::string &str)
int compare_nocase (const std::string &s, const std::string &s2)
int compare_nocase (const std::string &s, const char *s2)
int find_nocase (const std::string &s, const std::string &s2)
int find_nocase (const std::string &s, const char *s2)
unsigned int rwHash (const std::string &str)

Function Documentation

◆ compare_nocase() [1/2]

int bes::String::compare_nocase ( const std::string & s,
const char * s2 )
inline

Definition at line 55 of file InstallArea/x86_64-el9-gcc13-dbg/include/MdcRecoUtil/String.h.

55 {
56 return strcasecmp( s.c_str(), s2 );
57 }
XmlRpcServer s

◆ compare_nocase() [2/2]

int bes::String::compare_nocase ( const std::string & s,
const std::string & s2 )

Definition at line 25 of file String.cxx.

25 {
26 std::string::const_iterator p = s.begin();
27 std::string::const_iterator p2 = s2.begin();
28
29 while ( p != s.end() && p2 != s2.end() )
30 {
31 if ( toupper( *p ) != toupper( *p2 ) ) return ( toupper( *p ) < toupper( *p2 ) ) ? -1 : 1;
32 ++p;
33 ++p2;
34 }
35 return ( s2.size() == s.size() ) ? 0 : ( s.size() < s2.size() ) ? -1 : 1;
36}
double p2[4]

◆ find_nocase() [1/2]

int bes::String::find_nocase ( const std::string & s,
const char * s2 )
inline

Definition at line 61 of file InstallArea/x86_64-el9-gcc13-dbg/include/MdcRecoUtil/String.h.

61 {
62 return find_nocase( s, std::string( s2 ) );
63 }
int find_nocase(const std::string &s, const std::string &s2)
Definition String.cxx:38

◆ find_nocase() [2/2]

int bes::String::find_nocase ( const std::string & s,
const std::string & s2 )

Definition at line 38 of file String.cxx.

38 {
39 std::string str1 = s;
40 transformToUpper( str1 );
41 std::string str2 = s2;
42 transformToUpper( str2 );
43 return str1.find( str2 );
44}

Referenced by find_nocase().

◆ lowerCh()

void bes::String::lowerCh ( char & c)
inline

Definition at line 35 of file InstallArea/x86_64-el9-gcc13-dbg/include/MdcRecoUtil/String.h.

35{ c = tolower( c ); }

Referenced by transformToLower().

◆ rwHash()

unsigned int bes::String::rwHash ( const std::string & str)

Definition at line 58 of file String.cxx.

58 {
59 const char* data = str.c_str();
60 int length = str.size(), total = 0;
61 for ( int i = 0; i < length; i++ ) total += data[i];
62 return total;
63}
TTree * data

◆ toLower()

std::string bes::String::toLower ( const std::string & str)

Definition at line 46 of file String.cxx.

46 {
47 std::string result( str );
48 transformToLower( result );
49 return result;
50}

◆ toUpper()

std::string bes::String::toUpper ( const std::string & str)

Definition at line 52 of file String.cxx.

52 {
53 std::string result( str );
54 transformToUpper( result );
55 return result;
56}

◆ transformToLower()

void bes::String::transformToLower ( std::string & str)
inline

Definition at line 38 of file InstallArea/x86_64-el9-gcc13-dbg/include/MdcRecoUtil/String.h.

38 {
39 std::for_each( str.begin(), str.end(), lowerCh );
40 }

Referenced by toLower().

◆ transformToUpper()

void bes::String::transformToUpper ( std::string & str)
inline

Definition at line 41 of file InstallArea/x86_64-el9-gcc13-dbg/include/MdcRecoUtil/String.h.

41 {
42 std::for_each( str.begin(), str.end(), upperCh );
43 }

Referenced by find_nocase(), and toUpper().

◆ upperCh()

void bes::String::upperCh ( char & c)
inline

Definition at line 36 of file InstallArea/x86_64-el9-gcc13-dbg/include/MdcRecoUtil/String.h.

36{ c = toupper( c ); }

Referenced by transformToUpper().