DataParsing.cpp
上传用户:hnzycx
上传日期:2022-08-09
资源大小:12567k
文件大小:1k
开发平台:

Visual C++

  1. #include "StdAfx.h"
  2. #include "DataParsing.h"
  3. CDataParsing::CDataParsing(CString in)
  4. {
  5. cIn=in;
  6. }
  7. CDataParsing::~CDataParsing(void)
  8. {
  9. delete [] returnForDB;
  10. }
  11. void CDataParsing::ProcessDataForDB(CStringList &currUseStrList)
  12. {
  13. CString temp=cIn;
  14. CString current;
  15. CString inner;
  16. CString removeStr;
  17. int underlinePos;
  18. CStringList currUseStrList1;
  19. for(inner=temp;;inner.Replace(removeStr,_T("")))
  20. {
  21. underlinePos=inner.Find(_T("@"));
  22. if(underlinePos!=-1)
  23. {
  24. current=inner.Left(underlinePos);//@左边
  25. currUseStrList1.AddTail(current);
  26. removeStr=inner.Left(underlinePos+1);//@左边,含@
  27. }
  28. else
  29. {
  30. inner.Replace(_T("rn"),_T(""));
  31. currUseStrList1.AddTail(inner);
  32. break;
  33. }
  34. }
  35. POSITION pos=currUseStrList1.GetHeadPosition();
  36.     CString metaData;
  37. //循环把每个元组数据取出
  38. while(pos)
  39. {
  40. //对每个元组数据进行处理
  41. metaData=currUseStrList1.GetNext(pos);
  42.         for(inner=metaData;;inner.Replace(removeStr,_T("")))
  43. {
  44. underlinePos=inner.Find(_T("#"));
  45.          if(underlinePos!=-1)
  46.  {
  47.                   current=inner.Left(underlinePos);
  48.                   currUseStrList.AddTail(current);
  49.                   removeStr=inner.Left(underlinePos+1);
  50.  }
  51.  else
  52.  {
  53.                   currUseStrList.AddTail(inner);
  54.  break;
  55.  }
  56. }
  57.     }
  58. }