public class Name
extends java.lang.Object
A Name object that encapsulates a name string, and contains the logic
for handling with Regexes.
This class is not thread-safe.
| Constructor and Description |
|---|
Name(java.lang.String str)
Creates a new Name object.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
chopWithRegex(java.lang.String regex,
int submatchIndex)
Uses a regex to chop off and return part of the namestring.
|
void |
flip(java.lang.String flipAroundChar)
Flips the front and back parts of a name with one another.
|
java.lang.String |
getStr()
Gets the encapsulated string.
|
void |
norm()
Removes extra whitespace and punctuation from
this.str. |
void |
setStr(java.lang.String str)
Sets the encapsulated string value.
|
public Name(java.lang.String str)
str - encapsulated string.public java.lang.String getStr()
public void setStr(java.lang.String str)
str - string valuepublic java.lang.String chopWithRegex(java.lang.String regex,
int submatchIndex)
regex - matches the part of the namestring to chop offsubmatchIndex - which of the parenthesized submatches to usepublic void flip(java.lang.String flipAroundChar)
throws ParseException
flipAroundChar - the character(s) demarcating the two halves you want to flip.ParseException - if a regex fails or a condition is not expectedpublic void norm()
Removes extra whitespace and punctuation from this.str.
Strips whitespace chars from ends, strips redundant whitespace, converts whitespace chars to " ".
Copyright © 2015-2020 TupiLabs. All Rights Reserved.