如何使用索引获得特定值
How to get specific value by using index
我想从这种类型的字符串中提取" 2017-11-10"值的日期 "(D(2017-11-10)"。
我试图从2017年开始直接达到价值,因为我不想要
"(d("在最后的字符串中,但我不知道该怎么做。
我尝试过这样的尝试
int date= istr.SearchSubString("D(");
但这仅搜索"(D(2017-11-10)"的起始部分,这还可以
但是现在我该如何获得" 2017-11-10",这是我的日期。
使用正则表达式是最简单的解决方案:
std::string date = "(D(2017-10-11)";
std::regex dateRegex("(D(");
std::string newDate = std::regex_replace(date, dataRegex, ""); //This will replace the (D( with an empty string
相关文章:
- 使用索引与迭代器将向量迭代到倒数第二个元素
- 使用索引设置矢量枚举时的奇怪行为
- 使用索引将 BST 值存储到数组中
- 错误:使用索引寻址和 Clang 的指令的操作数无效
- 从对象创建矢量包装器,该对象只允许使用索引访问向量
- 为什么在C 中使用索引运算符被认为是不好的样式
- 如何使用索引访问C 结构属性值
- 如何使用索引获得特定值
- 在DirectX 11中使用索引缓冲区;它怎么知道
- 使用索引数组订购 ArrayFire Array 的最佳方式
- 将值分配给2D数组,而无需在C 中使用索引
- 字符串中消失的字符,但使用索引访问
- 使用索引向量擦除另一个向量的索引
- 为什么在 std::vector 中使用索引超出范围的运算符 [] 时没有出现异常?
- 多维数组初始化使用索引技巧
- 数组使用索引返回最大值
- 如何在可变参数模板中使用索引
- 避免使用索引项的重复条目
- 使用索引缓冲区对象时出现奇怪的分段错误
- 如何使用索引的 PNG 图像作为 SDL2/OpenGL 的纹理