My Project
Classes | Functions
Utility Namespace Reference

many function can be global actually More...

Classes

class  two
 Try to replace pair with two. More...
 

Functions

bool isSubstring (string sub, string s)
 Check whether sub is the substring of s. More...
 
int substringFirstIndex (string sub, string s)
 find the index of sub in string s More...
 
int strToInt (string s)
 
string fun_parent_parent ()
 
void cut (char *pt)
 
int stringToInt (string s)
 
double stringToDouble (std::string s)
 
long stringToLong (std::string s)
 
float stringToFloat (std::string s)
 
string charToString (char ch)
 
void begin ()
 
void begin (const char *name)
 
void end ()
 
string fun_parent ()
 
void print (Vector3 v)
 
void print (DDLinkedList< Vector3 > *ddl)
 

Detailed Description

many function can be global actually

Function Documentation

◆ isSubstring()

bool Utility::isSubstring ( string  sub,
string  s 
)

Check whether sub is the substring of s.

bool b = isSubstring("", "") => true
bool b = isSubstring("", "a") => true
bool b = isSubstring("bc", "abc") => true

◆ substringFirstIndex()

int Utility::substringFirstIndex ( string  sub,
string  s 
)

find the index of sub in string s

  • If sub is empty, then return -1
  • If found sub is the sub of s, then return the first index in s
substringFirstIndex("", "a") => -1
substringFirstIndex("a", "ba") => 1