As mentioned in the comments, regular expressions work well for this kind of thing. Use the module regex. Like so:
#include <iostream>
#include <cstdlib>
#include <regex>
int main()
{
const std::string s = "X:-600.913 Y:100.54 Z:412.22";
std::smatch m;
std::regex e(R"(X:(-?d+.d+)sY:(-?d+.d+)sZ:(-?d+.d+))");
if (std::regex_search(s, m, e))
std::cout << "X:" << m[1] << " Y:" << m[2] << " Z:" << m[3] << std::endl;
}
X:-600.913 Y:100.54 Z:412.22
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…