CBinary string2CBinary(string strSr) { CBinary binCsCode; if(strSrc.size() == 0) { return binCsCode; } //組成binary須要的格式,如"0xAB,0x12,0x23" string strDest; string strTemp; for(int i=0;i<strSrc.size();i++ { strTemp += strSrc.at(i); if((i+1)%2 == 0) { strDest += "0x" + strTemp + ","; strTemp.clear(); } } strDest = strDest.substr(0,strDest.size()-1); binCsCode = TextToBin(strDest); return binCsCode; }