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

String net::sf::json::JSONArray::join ( String  separator,
boolean  stripQuotes 
) [inline]

Make a string from the contents of this JSONArray. The separator string is inserted between each element. Warning: This method assumes that the data structure is acyclical.

Parameters:
separator A string that will be inserted between the elements.
Returns:
a string.
Exceptions:
JSONException If the array contains an invalid number.

Definition at line 2088 of file JSONArray.java.

References elements, and size().

                                                               {
      int len = size();
      StringBuffer sb = new StringBuffer();

      for( int i = 0; i < len; i += 1 ){
         if( i > 0 ){
            sb.append( separator );
         }
         String value = JSONUtils.valueToString( this.elements.get( i ) );
         sb.append( stripQuotes ? JSONUtils.stripQuotes( value ) : value );
      }
      return sb.toString();
   }


Generated by  Doxygen 1.6.0   Back to index