1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| std::string GetOracleClassTableName(std::string a_strTableName)
{
std::string strTabName = a_strTableName;
char sz[1024];
std::map<char,char> mapTrans;
std::string strSource(" ûùéèêàâîïôöç,;:!§/.?&%¨^/*+&\"''()={[|`\\^@]}°µ-");
std::string strDestination("_uueeeaaiiooc");
unsigned int lenD = strDestination.length();
for(unsigned int i = 0; i < strSource.length(); i++)
{
if (i < lenD)
mapTrans[strSource[i]] = strDestination[i];
else
mapTrans[strSource[i]] = NULL;
}
int c = 0;
for(unsigned int i = 0; i < strTabName.size(); i++)
{
std::map<char,char>::iterator it = mapTrans.find(strTabName[i]);
//std::string::iterator it2 = strTabName.at(i);
if (it != mapTrans.end())
{
if (mapTrans[strTabName[i]])
{
//strTabName[i] = mapTrans[strTabName[i]];
sz[c] = mapTrans[strTabName[i]];
c = c + 1;
}
/*else
strTabName.erase(it2);*/
}
else
{
sz[c] = strTabName[i];
c = c + 1;
}
}
sz[c] = '\0';
/*if (wstrTabName.length() > 30)
{
wstrTabName.clear();
wstrTabName = a_wstrTableName.substr(0,30);
}*/
strTabName.clear();
strTabName = sz;
return strTabName;
}
void CTRANSLATE_In_CppDlg::OnBnClickedOk()
{
std::string strTest = GetOracleClassTableName("(élève) contrôle @ Yahoo . fr éé$éé");
CString str(strTest.c_str());
AfxMessageBox(str);
} |
Partager