NCL Home > Documentation > Functions > Variable query

isstring

Returns True if input is of type string.

Prototype

	function isstring (
		arg       
	)

	return_val [1] :  logical

Arguments

arg

A variable of any type and dimensionality.

Description

If the input is of type string, then isstring will return a single scalar value of True, and False otherwise. If arg is not a valid variable, an error message will be printed.

See Also

isbyte, ischar, isdouble, isfile, isfloat, isgraphic, isinteger, islogical, islong, isnumeric, isshort, isstring

Examples

Example 1

In the example below, some variable types can be created on the fly by assigning a value to them:

  d  = 10000.d                 ; The "d" at the end forces a double variable
  st = "This is a string"

Some have to be created via the new command:

  b  = new(1,byte)
  c  = new(1,char)

The " numeric" type cannot be created. It includes all variables of type byte, short, integer, long, float, and double.

Every print statement below should return True:

  b  = new(1,byte)
  c  = new(1,char)
  d  = 10000.d                 ; The "d" at the end forces a double variable
  fl = 1.0
  fi  = addfile("testfile.nc","c")
  g  = new(1,graphic)
  i  = 20
  l1 = False
  l2 = new(1,long)
  sh = new(1,short)
  st = "This is a string"

  print(isbyte(b))
  print(ischar(c))
  print(isdouble(d))
  print(isfloat(fl))
  print(isfile(fi))
  print(isgraphic(g))
  print(isinteger(i))
  print(islogical(l1))
  print(islong(l2))
  print(isshort(sh))
  print(isstring(st))

  print(isnumeric(b))
  print(isnumeric(sh))
  print(isnumeric(i))
  print(isnumeric(l2))
  print(isnumeric(fl))
  print(isnumeric(d))