String Content Type



[1]
strX.type({#prop / flags}) content type
  Returns Boolean / List / PropList / err
  #prop Return a propList
  flags One or more flags to check the string against. If a flag is used, the result will be true or false
     
  Description

If no arguments are passed, this command will return a list containing the type (e.g [#lower, #alpha, #alphanum]) of strX.

If #prop is passed, the result will be a propList containing flag:boolean pairs, for all flags.

If one or more flags are passed, the Xtra will return true if the string's content qualifies for all flags, or false otherwise.

If an invalid argument is passed, or an error occurs, an <err> will be returned.

 

flags:

#upper all characters are upper case
#lower all characters are lower case
#num

all characters are numerical (integral) values

#whtSpc all characters are white space characters
#punct all characters are punctuation characters
#cntrl all characters are control characters
#space

all characters are blank characters (tab or space)

#hex all characters can belong to a hex string
#alpha all characters are letters
#alphanum all characters are letters or numbers
#numpunct all characters are numbers or punctuation characters
     
  Examples put _d("abc").type()
-- [#lower, #hex, #alpha, #alphaNum]
put _d("abc").type(#prop)
-- [#upper: 0, #lower: 1, #num: 0, #whtSpc: 0, #punct: 0, #cntrl: 0, #space: 0, #hex: 1, #alpha: 1, #alphaNum: 1, #numPunct: 0]
put _d("abc").type(#alpha, #lower)
-- 1
put _d("ABC").type(#lower)
-- 0
     
  Notes