Logo Search packages:      
Sourcecode: libjson-java version File versions

int net::sf::json::JSONArray::optInt ( int  index,
int  defaultValue 
) [inline]

Get the optional int value associated with an index. The defaultValue is returned if there is no value for the index, or if the value is not a number and cannot be converted to a number.

Parameters:
index The index must be between 0 and size() - 1.
defaultValue The default value.
Returns:
The value.

Definition at line 2203 of file JSONArray.java.

References getInt().

                                                    {
      try{
         return getInt( index );
      }catch( Exception e ){
         return defaultValue;
      }
   }


Generated by  Doxygen 1.6.0   Back to index