mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-31 07:55:38 +08:00
53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
/*******************************************************************************
|
|
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
|
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
* Proprietary and confidential.
|
|
******************************************************************************/
|
|
#pragma once
|
|
|
|
#include "./Error.h"
|
|
|
|
#include <vector>
|
|
|
|
namespace zilliz {
|
|
namespace milvus {
|
|
namespace server {
|
|
|
|
class StringHelpFunctions {
|
|
private:
|
|
StringHelpFunctions() = default;
|
|
|
|
public:
|
|
static void TrimStringBlank(std::string &string);
|
|
|
|
static void TrimStringQuote(std::string &string, const std::string &qoute);
|
|
|
|
//split string by delimeter ','
|
|
// a,b,c a | b | c
|
|
// a,b, a | b |
|
|
// ,b,c | b | c
|
|
// ,b, | b |
|
|
// ,, | |
|
|
// a a
|
|
static ServerError SplitStringByDelimeter(const std::string &str,
|
|
const std::string &delimeter,
|
|
std::vector<std::string> &result);
|
|
|
|
//assume the table has two columns, quote='\"', delimeter=','
|
|
// a,b a | b
|
|
// "aa,gg,yy",b aa,gg,yy | b
|
|
// aa"dd,rr"kk,pp aadd,rrkk | pp
|
|
// "aa,bb" aa,bb
|
|
// 55,1122\"aa,bb\",yyy,\"kkk\" 55 | 1122aa,bb | yyy | kkk
|
|
// "55,1122"aa,bb",yyy,"kkk" illegal
|
|
static ServerError SplitStringByQuote(const std::string &str,
|
|
const std::string &delimeter,
|
|
const std::string "e,
|
|
std::vector<std::string> &result);
|
|
|
|
};
|
|
|
|
}
|
|
}
|
|
}
|