12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // Created by Ht on 2022/11/10.
- //
- #ifndef IOT_EDGE_VDALNEW_JAEXUTIL_H
- #define IOT_EDGE_VDALNEW_JAEXUTIL_H
- #include <qlibc/qlibc.h>
- namespace ja {
- class JE_API JAExUtil {
- public:
- static void clearTypePrefix (std::string& dest) {
- if(dest.empty() || dest == "$null") {
- dest.clear();
- return;
- }
- //查找
- auto next = dest.find("__$");
- auto size = dest.size();
- while(next!=std::string::npos && next < size-1) {
- auto t = dest[next+3];
- switch (t) {
- case 'n': //数字 __$n
- case 'b': //布尔
- case 'f': //浮点
- case 's': //字符串
- case 'o': //对象
- dest.erase(next, 4);
- size = dest.size();
- break;
- default: //不做改变
- break;
- }
- if(next>=size) break;
- next = dest.find("__$", next+1);
- }
- }
- };
- }
- #endif //IOT_EDGE_VDALNEW_JAEXUTIL_H
|