replace internal functions in storage sample code (#5196)

This commit is contained in:
JinmingHu 2023-11-27 12:50:23 +08:00 committed by GitHub
parent 4a32d7266c
commit 74f6896a4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,12 +26,20 @@ std::string GetConnectionString()
std::string GetAccountName()
{
return Azure::Storage::_internal::ParseConnectionString(GetConnectionString()).AccountName;
const auto connectionString = GetConnectionString();
const std::string property = "AccountName=";
auto pos1 = connectionString.find(property);
auto pos2 = connectionString.find(";", pos1);
return connectionString.substr(pos1 + property.length(), pos2 - pos1 - property.length());
}
std::string GetAccountKey()
{
return Azure::Storage::_internal::ParseConnectionString(GetConnectionString()).AccountKey;
const auto connectionString = GetConnectionString();
const std::string property = "AccountKey=";
auto pos1 = connectionString.find(property);
auto pos2 = connectionString.find(";", pos1);
return connectionString.substr(pos1 + property.length(), pos2 - pos1 - property.length());
}
int main()