parseName

Name sutil.parseName ( String name ) (pro and enterprise editions only)

Description

Attempts to parse a string to a name. The parser is not perfect and works best on english formatted names (for example, "John Smith Jr." or "Guerrero, Antonio K". This uses standard settings for the parser. To get more control over how the name is parsed, use the EnglishNameParser class.

Parameters

  • name The name to be parsed.

Return Values

Returns the parsed name, as a Name object.

Change Log

Version Description
6.0.59a Available for professional and enterprise editions.

Examples

How to use the name parser

    String nameRaw = "John Fred Doe";
    DataRecord dr = new DataRecord();

    log.debug( "Name raw: " + nameRaw );
    if( nameRaw!=null )
    {
        try
        {
            Name name = sutil.parseName( nameRaw );
            log.debug( "First name: " + name.getFirstName() );
            log.debug( "Middle name: " + name.getMiddleName() );
            log.debug( "Last name: " + name.getLastName() );
            //log.debug( "Suffix: " + name.getSuffix() );

            dr.put( "FIRST_NAME", name.getFirstName() );
            dr.put( "MIDDLE_NAME", name.getMiddleName() );
            dr.put( "LAST_NAME", name.getLastName() );
            //dr.put( "SUFFIX", name.getAllSuffixString() );
        }
        catch( Exception e )
        {
            // The parser may throw an exception if it can't
            // parse the name.  If this occurs we want to know about it.
            log.warn( "Error parsing name: " + e.getMessage() );
        }
    }

See Also

Name sutil.parseName ( String name ) (pro and enterprise editions only)

Description

Attempts to parse a string to a name. The parser is not perfect and works best on english formatted names (for example, "John Smith Jr." or "Guerrero, Antonio K". This uses standard settings for the parser. To get more control over how the name is parsed, use the EnglishNameParser class.

Parameters

  • name The name to be parsed.

Return Values

Returns the parsed name, as a Name object.

Change Log

Version Description
6.0.59a Available for professional and enterprise editions.

Examples

How to use the name parser

    String nameRaw = "John Fred Doe";
    DataRecord dr = new DataRecord();

    log.debug( "Name raw: " + nameRaw );
    if( nameRaw!=null )
    {
        try
        {
            Name name = sutil.parseName( nameRaw );
            log.debug( "First name: " + name.getFirstName() );
            log.debug( "Middle name: " + name.getMiddleName() );
            log.debug( "Last name: " + name.getLastName() );
            //log.debug( "Suffix: " + name.getSuffix() );

            dr.put( "FIRST_NAME", name.getFirstName() );
            dr.put( "MIDDLE_NAME", name.getMiddleName() );
            dr.put( "LAST_NAME", name.getLastName() );
            //dr.put( "SUFFIX", name.getAllSuffixString() );
        }
        catch( Exception e )
        {
            // The parser may throw an exception if it can't
            // parse the name.  If this occurs we want to know about it.
            log.warn( "Error parsing name: " + e.getMessage() );
        }
    }

See Also