title: Cocos2D X: How to check if a key exists for a plist file?
body: <p>I am using the following code to read data from plist for my game:</p>
  
  <pre><code>int levelNum = SOME_VALUE_FROM_OUTSIDE;
  
  ValueMap mapFile = FileUtils::getInstance()-&gt;getValueMapFromFile("LevelDetails.plist");
  
  std::string strLevel = std::to_string(levelNum);
  
  ValueMap mapLevel = mapFile.at(strLevel).asValueMap();
  </code></pre>
  
  <p>LevelDetails.plist is a plist with dictionary as root. The problem is there can be occasions where there is no key named levelNum / strLevel. So I have to check if the key exists before I run this line:</p>
  
  <pre><code>ValueMap mapLevel = mapFile.at(strLevel).asValueMap(); //Throws exception occasionally
  </code></pre>
  
  <p>So what is the proper way to check if a key named levelNum / strLevel exists or not?</p>