cdm/src/main/java/ucar/ma2/ArrayChar.java
public String getString(Index ima) {
    int rank = getRank();
    if (rank == 0)
      throw new IllegalArgumentException("ArayChar.getString rank must not be 0");
    if (rank == 1)
      return getString();

    int strLen = indexCalc.getShape(rank - 1);

    char[] carray = new char[strLen];
    int count = 0;
    for (int k = 0; k < strLen; k++) {
      ima.setDim(rank - 1, k);
      carray[k] = getChar(ima);
      if (0 == carray[k])
        break;
      count++;
    }
    return new String(carray, 0, count);
  }
public String getString(Index ima) {
    int rank = getRank();
    if (rank == 0)
      throw new IllegalArgumentException("ArayChar.getString rank must not be 0");
    if (rank == 1)
      return getString();

    int strLen = indexCalc.getShape(rank - 1);

    char[] carray = new char[strLen];
    int count = 0;
    for (int k = 0; k < strLen; k++) {
      ima.setDim(rank - 1, k);
      carray[k] = getChar(ima);
      if (0 == carray[k])
        break;
      count++;
    }
    return new String(carray, 0, count);
  }
public String getString ( Index ima ) { int rank = getRank ( ) ; if ( rank == 0 ) throw new IllegalArgumentException ( "ArayChar.getString rank must not be 0" ) ; if ( rank == 1 ) return getString ( ) ; int strLen = indexCalc . getShape ( rank - 1 ) ; char [ ] carray = new char [ strLen ] ; int count = 0 ; for ( int k = 0 ; k < strLen ; k ++ ) { ima . setDim ( rank - 1 , k ) ; carray [ k ] = getChar ( ima ) ; if ( 0 == carray [ k ] ) break ; count ++ ; } return new String ( carray , 0 , count ) ; }
Create a String out of this ArrayChar object. The rank must be 1 or greater.
If there is a null (0) value in the ArrayChar array, the String will end there.
The null is not returned as part of the String.
<p/>
If rank=1, then this will make a string out of the entire CharArray, ignoring ima.
If rank is greater than 1, then make a String out of the characters of the last dimension,
indexed by ima.  This method treats the CharArray like an array of Strings, and
allows you to iterate over them, eg for a 2D ArrayChar:
<p><code>
ArrayChar ca;
Index ima = ca.getIndex();
for (int i=0; i<ca.getShape()[0]; i++)
String s = ca.getString(ima.set0(i));
</code>

@param ima the Index of where in the Array to start.
@return String value of CharArray
@throws IllegalArgumentException if rank != 1
Create a String out of this ArrayChar object . The rank must be 1 or greater . If there is a null ( 0 ) value in the ArrayChar array the String will end there . The null is not returned as part of the String . <p / > If rank = 1 then this will make a string out of the entire CharArray ignoring ima . If rank is greater than 1 then make a String out of the characters of the last dimension indexed by ima . This method treats the CharArray like an array of Strings and allows you to iterate over them eg for a 2D ArrayChar : <p > <code > ArrayChar ca ; Index ima = ca . getIndex () ; for ( int i = 0 ; i<ca . getShape () [ 0 ] ; i ++ ) String s = ca . getString ( ima . set0 ( i )) ; < / code >