小编sT0*_*0n3的帖子

在文件中搜索电话号码模式

我需要有关 C++ 代码的帮助。

我想搜索一个文件并逐行读取它,如果电话号码的父级匹配,它必须将该行打印到另一个文件中。

我能够匹配字符串但不确定:如何匹配电话号码的格式/模式电话号码可以不同。我只想遵循电话号码匹配的格式。

Number 的示例可以是 xx-xxx-xxxx

这是我的代码看看

// reading a text file

         if (mywritingfile.is_open())
         {

                  //Getting data line from file.
              while ( getline (myfile,line) )
            {

                 if (Match the Pattren from the line)//Need Help Here.
                 {   
                     //Printing the Mached line Content Of the source File to the destination the File.
                     //Output Every line that it fetches
                     cout << line << endl;
                     mywritingfile << line << endl;
                     matches++;   
                 }
            }
         }
Run Code Online (Sandbox Code Playgroud)

c++ regex

1
推荐指数
1
解决办法
3254
查看次数

如何访问名称中带有冒号的 JSON 对象键

我需要一些关于如何使用 Javascript 访问 JSON 对象的密钥的指导:"yweather:forecast"。我尝试过json.yweather:forecast,但它抛出一个错误。

{
    "yweather:forecast" : [
        {
            "@day":"Wed",
            "@date":"10 Jul 2013",
            "@low":"75"      
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

javascript json

-2
推荐指数
1
解决办法
3441
查看次数

标签 统计

c++ ×1

javascript ×1

json ×1

regex ×1