cdm/src/main/java/ucar/nc2/Attribute.java
private void setStringValue(String val) {
    if (val == null)
      throw new IllegalArgumentException("Attribute value cannot be null");

    // get rid of trailing nul characters
    int len = val.length();
    while ((len > 0) && (val.charAt(len - 1) == 0))
      len--;
    if (len != val.length())
      val = val.substring(0, len);

    this.svalue = val;
    this.nelems = 1;
    this.dataType = DataType.STRING;

    //values = Array.factory(String.class, new int[]{1});
    //values.setObject(values.getIndex(), val);
    //setValues(values);
  }
private void setStringValue(String val) {
    if (val == null)
      throw new IllegalArgumentException("Attribute value cannot be null");

    // get rid of trailing nul characters
    int len = val.length();
    while ((len > 0) && (val.charAt(len - 1) == 0))
      len--;
    if (len != val.length())
      val = val.substring(0, len);

    this.svalue = val;
    this.nelems = 1;
    this.dataType = DataType.STRING;

    //values = Array.factory(String.class, new int[]{1});
    //values.setObject(values.getIndex(), val);
    //setValues(values);
  }
private void setStringValue ( String val ) { if ( val == null ) throw new IllegalArgumentException ( "Attribute value cannot be null" ) ; // get rid of trailing nul characters int len = val . length ( ) ; while ( ( len > 0 ) && ( val . charAt ( len - 1 ) == 0 ) ) len -- ; if ( len != val . length ( ) ) val = val . substring ( 0 , len ) ; this . svalue = val ; this . nelems = 1 ; this . dataType = DataType . STRING ; //values = Array.factory(String.class, new int[]{1}); //values.setObject(values.getIndex(), val); //setValues(values); }
set the value as a String, trimming trailing zeroes

@param val value of Attribute
set the value as a String trimming trailing zeroes