cdm/src/main/java/ucar/nc2/NetcdfFile.java
public Variable addStringVariable(Group g, String shortName, String dims, int strlen) {
    if (immutable) throw new IllegalStateException("Cant modify");
    if (g == null) g = rootGroup;
    String dimName = shortName + "_strlen";
    addDimension(g, new Dimension(dimName, strlen));
    Variable v = new Variable(this, g, null, shortName);
    v.setDataType(DataType.CHAR);
    v.setDimensions(dims + " " + dimName);
    g.addVariable(v);
    return v;
  }
public Variable addStringVariable(Group g, String shortName, String dims, int strlen) {
    if (immutable) throw new IllegalStateException("Cant modify");
    if (g == null) g = rootGroup;
    String dimName = shortName + "_strlen";
    addDimension(g, new Dimension(dimName, strlen));
    Variable v = new Variable(this, g, null, shortName);
    v.setDataType(DataType.CHAR);
    v.setDimensions(dims + " " + dimName);
    g.addVariable(v);
    return v;
  }
public Variable addStringVariable ( Group g , String shortName , String dims , int strlen ) { if ( immutable ) throw new IllegalStateException ( "Cant modify" ) ; if ( g == null ) g = rootGroup ; String dimName = shortName + "_strlen" ; addDimension ( g , new Dimension ( dimName , strlen ) ) ; Variable v = new Variable ( this , g , null , shortName ) ; v . setDataType ( DataType . CHAR ) ; v . setDimensions ( dims + " " + dimName ) ; g . addVariable ( v ) ; return v ; }
Create a new Variable of type Datatype.CHAR, and add to the given group.

@param g         add to this group. If group is null, use root group
@param shortName short name of the Variable
@param dims      list of dimension names
@param strlen    dimension length of the inner (fastest changing) dimension
@return the new Variable
Create a new Variable of type Datatype . CHAR and add to the given group .