#pragma once
#include <vector>
#include <string>

using namespace std;

enum TEST_LOG
{
	LOG_REQ = 0,
	LOG_RES
};

class MyStringUtils
{
public:
	static void split(std::vector<std::string>& vecLine, const  std::string& str, const std::string& delim = "\n");
	static void  toUpper(std::string& str);
	static void  toLower(std::string& str);
	static std::string& trim(std::string& str, const std::string& strTrim = " ");
	static std::string replace(std::string& str, std::string strOld, std::string strNew);
	static unsigned long toLong(std::string& strCount, int nType = 10);
	static int toInt(std::string& strCount);
	static std::string toString(unsigned char* buffer, int len);
	static std::string toString(unsigned int nValue);
	static std::string toString(int nValue, int radix=16);
	static std::string toString(uint8_t nValue);
	static void CutOut(std::string& strCount, const std::string& strCut = "//");
	static int SplitStringByRegExp(const std::string& str, std::vector<std::string>& vecLine, const std::string& reg);
	static void BufferToString(std::string& strLog, unsigned char* buff, int len, unsigned char type = 0);
	static bool startWith(const std::string& str, std::string prefix);
	static bool endWith(const std::string& str, std::string suffix);
	static std::string desensitize(std::string& str, int plainLen = 3);
	static bool radix_array2Hex(uint8_t* inParams, int inLen, string& str, const std::string strHold = " ");

	static string UTF8ToGBK(const std::string strUTF8);
	static string GBKToUTF8(const std::string szGbk);
};