Names - Performs various operations on proper names

Usage

  result = Names ( arg1 arg2 ... )

Parameters

  result The returned result depends on the arguments. It is usually a point on the Dim:Alpha dimension.
  argn A string/alpha point or one of the tagged arguments below.

Tagged Arguments

  Append::tagval Appends then defined name component to the current name. The tagval parameter must be itself a tagged value defining the particular name component.
  GivenName::string Defines the given or first name as string.
  Has::tagval Tests to see if the current name has tagval as a component. This must itself be a tagged value defining a particular name component. Logical:True or Logical:False are the two possible return values. Multiple Has tags may be given. All must match for Logical:True to be returned. If the matching is done on a hyphenated name then Logical:True results if the Has argument does not contain a hyphen (or dash) and is contained within the hyphenated name. If the argument contains a hyphen then the two names must match exactly.
  Mask::pattern Output the name according to the mask pattern. See below for pattern elements.
  MiddleName::string Defines the middle name as string.
  Name::namestr Defines the namestr as an internally formatted V4 name.
  NickName::string Defines nickname as string. More than one nickname may be given.
  Patronymic::string Defines the patronymic portion of a name (same as middle name).
  Replace::tagval Replaces the named component as defined by tagval with the new value. The tagval argument must itself be a tagged argument.
  Soundex::tagval Tests to see if the current name has a component that matches according to the soundex algorithm. The tagval argument must be a tagged value.
  Suffix::string Defines a name suffix as string. More than one suffix may be given. Typical suffixes include JR, III, MD, etc. V4 strips out punctuation and normalizes capitalization.
  Surname::string Defines the surname or family name (last) as string.
  Title::string Defines a title as string. More than one title may be given.
  Type::typenum Defines the type of name. The currently supported types are 0 (Western style), 1 (Hispanic), 2 (Chinese), 3 (Russian), 4 (Arabic).

Tagged Results

  Capitalize? Capitalizes the first letter of each name component and converts remaining letters to lower case.
  Format? Format the current name according to the defined type style.
  GivenName? Returns the given (first) name within the current name.
  LC? Convert the name to all lower case.
  MiddleName? Returns the middle name within the current name. The module fails if no middle name has been given.
  Name? Returns the corresponding internally formatted V4 name.
  Nickname? Returns all nicknames associated with the current name. The module fails if no nicknames have been given.
  Patronymic? Returns the patronymic (middle) name.
  Sort? Returns the name in a format suitable for sorting: 'surname givenname middle' in uppercase, no punctuation.
  Suffix? Returns any suffixes associated with the current name. The module fails if no suffixes are defined.
  SurName? Returns the surname or family name of the current name.
  Title? Returns any titles associated with the current name. The module fails if no titles are defined.
  Type? Returns the type code associated with the name.
  UC? Converts the name to all upper case.

Description

This module is used for manipulating people's names. The first argument is a name which, based on the type, is converted to a common internal format. Tagged arguments can then be used to extract or arrange any of the name components.

The Mask argument is used to format the name or any selected subset of the name. The table below describes the pattern elements. Any characters in the pattern that are not given below are copied as-is to the output string. If the selected element is not within the name then nothing is copied to the output string.

Table 14 - Format Mask Elements

G References the given (first) name
g References the first character of the given name
M The middle name
m The first character of the middle name
P References the patrynomic component of the name
p The first character of the patrynomic
N The nickname
S Refers to the surname (last name) component
s The first character of the surname
T The title
X The name suffix

v4_home:v4NamesInfo.v4i

Examples

  Names(GivenName::"John" Nickname::"OD" NickName::"Snake" MiddleName::"Q" Surname::"Doe" Name?) Alpha:"John#OD+Snake+Q%Doe!"
  Names("Doe, John" Format?) Alpha:"John Doe"
  Names("Doe, John" Type::2 Format?) Alpha:Doe John" (Chinese naming has surname first.)
  Names("John Doe" Soundex::Surname::"doh") Logical:True ("Doe" sounds like "doh")
  Names("John Doe" Has::Surname::"doe") Logical:True (capitalization does not matter)
  Names("Victor Hyde-Smithers" Has::Surname::"Smithers") Logical:True
  Names("Victor Hyde-Smithers" Has::Surname::"Hyde-Smithers") Logical:True
  Names("Victor Hyde-Smithers" Has::Surname::"Hyde-Smithee") Logical:False
  Names("Victor E. Hansen" Mask::"gms") Alpha:"VEH"
  Names("John Doe" Mask::"S, G") Doe, John

NE - Not Equal Test

Usage

  logical = NE ( npt1 npt2 )
  logical = NEk ( npt1 npt2 )

Parameters

  logical Logical:TRUE or FALSE depending on the result of the comparison.
  npt1 A point.
  npt2 A point.

Description

NE tests for the inequality of two point. Two points are not equal if they are of different dimensions or value. NEk differs from NE much like EQk differs from EQ. Two points are not equal only if their point values differ.

Examples

  NE(1 2) Logical:True
  NE(100 Real:100) Logical:True
  NEk(100 Real:100) Logical:False
  NE(Country:UK Country:UK) Logical:False

Nop - NoOperation

Usage

  true = Nop ( )
  true = Nop ( true )
  undef = Nop ( false )

Parameters

  none no parameters

Description

The NOp module does what is says- nothing. If it is called with no arguments it returns Logical:True. If it is called with an argument that evaluates to logical true it returns Logical:True. If the argument evaluates to false then NOp fails and does not return a value.

Examples

  Enum(list @NOp()) Enumerates through the list, but does nothing (unless the enumeration through the list performs some actions).

Not - Logical Not

Usage

  logres = Not ( logical )

Parameters

  logres Logical True or False- the compliment of its argument.
  logical An argument evaluating to True or False.

Description

The Not module returns the logical compliment of its argument.

Examples

  Not(12) Logical:False (12 evaluates to Logical:True)
  Not(Logical:False) Logical:True

Num - Performs Various Operations on Numbers and Dates

Usage

  list = Num ( base tagarg )

Parameters

  result The resulting list or number
  base The base number or date
  tagarg One or more of the tagged arguments below

Tagged Arguments

  By::amount Increment the elements of the list by amount.
  Number::num The total number of elements in the list.
  Prime::num Returns the first prime number that is equal to or greater than num.
  Round::npt Round number to specified precision of npt.
  Round::Down Round number down to nearest integer.
  Round::Up Round number up to nearest integer.
  To::num Generates a list of numbers from the base to num.

Tagged Results

  Abs? Returns the absolute value of the base.
  Fractional? Returns the fractional portion of the number.
  Integral? Returns the integral portion of the base.
  ListOf? Converts the first argument number into a list of digits and appropriate punctuation characters. The digits are points on Dim:Int and the punctuation characters are points on Dim:UV4 (UV4:Plus, UV4:Minus, UV4:Dot, UV4:Exponent).
  Negate? Returns the negative of the base.
  Number? The Num module returns the number of elements that would have been in the list.
  Prime? Returns TRUE if base is a prime number, FALSE otherwise.
  Sign? Returns the sign of the base number (-1 for negative, 0 for 0, +1 for positive).

Description

This module performs various operations on numbers and dates. Tagged results can be specified to convert or return information about the base. Combinations of the To, By, and Number tags are used to generate lists of numbers or dates.

See also the MakePm module for creating multiple-value points.

  Num(1234 Prime?) returns Logical:No
  Num(UDate:010101 By::15 Number::10) returns the list (UDate:01-Jan-01..UDate:16-May-01..15)
  Num(10 To::1000 By::23 Number?) returns Int:43 (the number of increments from 10 to 1000 by 23)
  Num(100 To::10) returns the list(Int:100..10..-1)
  Num(3.14159 Fractional?) returns Num:0.14159
  Num(123.45 Round::50) returns 100
  Num(123.456 Round::0.01) returns 123.46