m_string

Inctime is the main program.

Module

Description

A module to process strings.

Description
Make some operations in strings
History
  • 15 Dec 2010 - J. G. de Mattos - Initial Version
  • 02 Mar 2011 - J. G. de Mattos - Initial code to strTemplate
  • 30 Nov 2012 - J. G. de Mattos - All input parameters optionals in strTemplate
  • 05 Fev 2014 - J. G. de Mattos - Adding julian day mask
  • 20 jun 2014 - J. G. de Mattos - Adding GetTokens feature

Quick access

Variables:gettokens, replace, str_template, num2str, mon_lc, mon_uc, mon_wd
Routines:gettokens_(), float2str(), int2str(), replace_(), str_template_()

Variables

  • m_string/mon_wd
    shape:
    type:

    character

    attrs:

    private/parameter=(/’jan’,’feb’,’mar’,’apr’,’may’,’jun’,’jul’,’aug’,’sep’,’oct’,’nov’,’dec’/)

  • m_string/gettokens
    type:
    attrs:public

    Get tokens by line

  • m_string/replace
    type:
    attrs:public

    Replace a string by another

  • m_string/str_template
    type:
    attrs:public

    Replace variables in a template

  • m_string/mon_uc
    shape:
    type:

    character

    attrs:

    private/parameter=(/’jan’,’feb’,’mar’,’apr’,’may’,’jun’,’jul’,’aug’,’sep’,’oct’,’nov’,’dec’/)

  • m_string/mon_lc
    shape:
    type:

    character

    attrs:

    private/parameter=(/’jan’,’feb’,’mar’,’apr’,’may’,’jun’,’jul’,’aug’,’sep’,’oct’,’nov’,’dec’/)

  • m_string/num2str
    type:
    attrs:public

    convert a number to string

Subroutines and functions

subroutine m_string/str_template_(strg[, nymd[, nhms[, fymd[, fhms[, jd[, doy[, label]]]]]]])

A template formatting a string with variables.

Description
A template resolver formatting a string with a string variable and time variables. The format descriptors are similar to those used in the GrADS.
Variables
  • %y4 substitute with a 4 digit year
  • %y2 a 2 digit year
  • %m1 a 1 or 2 digit month
  • %m2 a 2 digit month
  • %mc a 3 letter month in lower cases
  • %Mc a 3 letter month with a leading letter in upper case
  • %MC a 3 letter month in upper cases
  • %d1 a 1 or 2 digit day
  • %d2 a 2 digit day
  • %h1 a 1 or 2 digit hour
  • %h2 a 2 digit hour
  • %h3 a 3 digit hour (?)
  • %n2 a 2 digit minute
  • %e a string ensemble identify
  • %jd a julian day without hours decimals
  • %jdh a julian day with hour decimals
  • %jy a day of current year without hours decimals
  • %jyh a day of current year with hours decimals
  • %ix1 initial 1 digit decade
  • %ix3 initial 3 digit decade
  • %iy2 initial 2 digit year
  • %iy4 initial 4 digit year
  • %im1 initial 1 or 2 digit month
  • %im2 initial 2 digit month (leading zero if needed)
  • %imc initial 3 character month abbreviation
  • %id1 initial 1 or 2 digit day (leading zero if needed)
  • %id2 initial 2 digit day
  • %ih1 initial 1 or 2 digit hour
  • %ih2 initial 2 digit hour
  • %ih3 initial 3 digit hour
  • %in2 initial 2 digit minute (leading zero if needed)
  • %fx1 forecast 1 digit decade
  • %fx3 forecast 3 digit decade
  • %fy2 forecast 2 digit year
  • %fy4 forecast 4 digit year
  • %fm1 forecast 1 or 2 digit month
  • %fm2 forecast 2 digit month (leading zero if needed)
  • %fmc forecast 3 character month abbreviation
  • %fd1 forecast 1 or 2 digit day (leading zero if needed)
  • %fd2 forecast 2 digit day
  • %fh1 forecast 1 or 2 digit hour
  • %fh2 forecast 2 digit hour
  • %fh3 forecast 3 digit hour
  • %fn2 forecast 2 digit minute (leading zero if needed)
History
  • Joao Gerd - 02Mar2011 - Codigo Inicial
  • Joao Gerd - 30Nov2012 - All input parameters optionals in strTemplate
  • Joao Gerd - 05Fev2014 - Adding julian day mask
Parameters:

strg [character,inout]

Options:
  • nymd [integer,in,optional]
  • nhms [integer,in,optional]
  • fymd [integer,in,optional]
  • fhms [integer,in,optional]
  • jd [real,in,optional]
  • doy [real,in,optional]
  • label [character,in,optional]
Call to:

replace_(), int2str(), float2str()

subroutine m_string/replace_(strg, mask, repl)
Description
Rotina para substituir a mask pela repl na strg.
History
  • Joao Gerd - 20Feb2011 - Codigo Inicial.
Parameters:
  • strg [character,inout] :: String
  • mask [character,in] :: maskout
  • repl [character,in] :: replacing string
Called from:

str_template_()

subroutine m_string/gettokens_(line, tokens, ntokens[, del])
Parameters:
  • line [character]
  • tokens (*) [character]
  • ntokens [integer]
Options:

del [character,optional]

function m_string/int2str(num, format)
Parameters:
  • num [integer,in]
  • format [character,in]
Return:

int2str [character]

Called from:

str_template_()

function m_string/float2str(num, format)
Parameters:
  • num [real,in]
  • format [character,in]
Return:

float2str [character]

Called from:

str_template_()