NCL Home >
Documentation >
Functions >
String manipulation
oneDtostring
Converts a 1-dimensional array to a single string.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" ; This library is automatically loaded
; from NCL V6.2.0 onward.
; No need for user to explicitly load.
function oneDtostring (
x
)
return_val [1] : string
Arguments
xAn array of any type.
Return value
A single scalar string is returned.
Description
This function takes an array of values, delimits them with commas, and returns this whole thing as a single string.
Examples
Example 1
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" begin maxYrs = (/1960,1969,1980,1989/) yrString = oneDtostring (maxYrs) print(yrString) endThis short script yields:
Variable: yrString Type: string Total Size: 4 bytes 1 values Number of Dimensions: 1 Dimensions and sizes: [1] Coordinates: Number Of Attributes: 1 _FillValue : missing (0) 1960,1969,1980,1989