#include <iostream>
#include <string>
int main()
{
std::string bai = "C:\\Users\\pjtseng\\Desktop\\tests.shp"; //file location
std::string newBai = "";
int x;
for ( x = bai.length() - 1; x >= 0;x--) //reverse string array numbers
{
if (bai[x] == '\\') //When I find \ ,break for loop
{
break;
}
}
newBai = bai.substr(0, x); // x = break number
std::cout << newBai; //You can see the true
return 0 ;
}
int main()
{
std::string originalSRID = "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]";
std::string newSRID = "";
for (auto& x : originalSRID) //I only need before "first , "
{
if (x == ','){ break; }
else { newSRID += x; }
}
std::cout << newSRID;
return 0 ;
}
沒有留言:
張貼留言