org.lsc.utils
Class FrenchFilters

java.lang.Object
  extended by org.lsc.utils.FrenchFilters

public final class FrenchFilters
extends Object

Manage all common string manipulation for french

Author:
Sebastien Bahloul ;

Field Summary
static String[] BAD_SEPARATOR_FOR_EMAIL
          Bad word separators chars for emails
static String[] BAD_SEPARATOR_FOR_PHONE
          Chars to replace in telephone numbers
static String[] GOOD_SEPARATOR_FOR_EMAIL
          Good words separators for emails
static String[] GOOD_SEPARATOR_FOR_PHONE
          Chars of remplactement for telephone numbers
 
Constructor Summary
FrenchFilters()
           
 
Method Summary
static boolean containsInTab(String[] array, String name)
          Deprecated. because the method is in Java
static String filterAlpha(String value)
          Filter all alphanumeric characters.
static String filterDate(String value, String format)
          Converts Date into timestamp string.
static String filterFirstName(String name)
          Deprecated. Use filterGivenName(String) instead.
static String filterGivenName(String oldValue)
          Filter a string to match a givenName
static String filterLastName(String name)
          Filter a string to match a last name
static String filterLengthString(String sn, int length)
           
static String filterName(String aString)
          Remove trailing and starting spaces and replace remaining spaces and dots by dashes
static String filterNomPatronymique(String name)
          Deprecated. 
static String filterNumber(String value)
          Filters numerical identifier.
static String filterPhone(String phone2parse)
          Transform a telephone number in the international display
static String filterPhones(String phone2parse)
          Deprecated. 
static String filterPrenomEtatCivil(String name)
          Deprecated. Use filterGivenName(String) instead.
static String filterRegexp(String src, String[] srcRegexp, String[] destRegexp)
          Filter the string src by removing the chars in srcRegexp by the ones in destRegexp
static String filterShortUid(String sn)
          Returns the uid on 8 chars and well formatted
static String filterSn(String sn)
          Format a sn
static String filterString(String aString)
          Deprecated. because it is a simple wrapper for a Java method
static String filterStringRegExp(String value, String regexp)
           
static String filterUid(String sn)
          Returns the uid on 14 chars and well formatted
static String generatePwd()
          Generate a 8 chars long password
static String removeBadChars(String src)
          Normalize accents and cedillas
static String toUpperCaseAllBeginningNames(String string)
          Uppercased all the words of a string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BAD_SEPARATOR_FOR_EMAIL

public static final String[] BAD_SEPARATOR_FOR_EMAIL
Bad word separators chars for emails


GOOD_SEPARATOR_FOR_EMAIL

public static final String[] GOOD_SEPARATOR_FOR_EMAIL
Good words separators for emails


BAD_SEPARATOR_FOR_PHONE

public static final String[] BAD_SEPARATOR_FOR_PHONE
Chars to replace in telephone numbers


GOOD_SEPARATOR_FOR_PHONE

public static final String[] GOOD_SEPARATOR_FOR_PHONE
Chars of remplactement for telephone numbers

Constructor Detail

FrenchFilters

public FrenchFilters()
Method Detail

containsInTab

@Deprecated
public static boolean containsInTab(String[] array,
                                               String name)
Deprecated. because the method is in Java

Find if a string is in an array

Parameters:
array - the array
name - the string
Returns:
boolean

removeBadChars

public static String removeBadChars(String src)
Normalize accents and cedillas

Parameters:
src - Source string
Returns:
Filtered string

filterRegexp

public static String filterRegexp(String src,
                                  String[] srcRegexp,
                                  String[] destRegexp)
Filter the string src by removing the chars in srcRegexp by the ones in destRegexp

Parameters:
src -
srcRegexp -
destRegexp -
Returns:
the filered string

filterPhone

public static String filterPhone(String phone2parse)
Transform a telephone number in the international display

Parameters:
phone2parse -
Returns:
the filtered phone number

filterPhones

@Deprecated
public static String filterPhones(String phone2parse)
Deprecated. 


toUpperCaseAllBeginningNames

public static String toUpperCaseAllBeginningNames(String string)
Uppercased all the words of a string

Parameters:
string -
Returns:
String with caps for all characters after space, "-", etc ...

filterSn

public static String filterSn(String sn)
                       throws CharacterUnacceptedException
Format a sn

Parameters:
sn -
Returns:
the filtered surname
Throws:
CharacterUnacceptedException - thrown if an rejected character is encountered during analysis

filterLengthString

public static String filterLengthString(String sn,
                                        int length)

filterUid

public static String filterUid(String sn)
Returns the uid on 14 chars and well formatted

Parameters:
sn - the last name to filter
Returns:
the filtered uid

filterShortUid

public static String filterShortUid(String sn)
Returns the uid on 8 chars and well formatted

Parameters:
sn - the last name to filter
Returns:
the filtered short uid

filterStringRegExp

public static String filterStringRegExp(String value,
                                        String regexp)
                                 throws CharacterUnacceptedException
Throws:
CharacterUnacceptedException

filterLastName

public static String filterLastName(String name)
                             throws CharacterUnacceptedException
Filter a string to match a last name

Parameters:
name - the last name to filter
Returns:
the filtered patronimic name
Throws:
CharacterUnacceptedException - thrown if an rejected character is encountered during analysis

filterNomPatronymique

@Deprecated
public static String filterNomPatronymique(String name)
                                    throws CharacterUnacceptedException
Deprecated. 

Throws:
CharacterUnacceptedException

filterFirstName

public static String filterFirstName(String name)
                              throws CharacterUnacceptedException
Deprecated. Use filterGivenName(String) instead.

Filter a string to match a first name

Parameters:
name - the first name to filter
Returns:
the filtered public given name
Throws:
CharacterUnacceptedException - thrown if an rejected character is encountered during analysis

filterPrenomEtatCivil

@Deprecated
public static String filterPrenomEtatCivil(String name)
                                    throws CharacterUnacceptedException
Deprecated. Use filterGivenName(String) instead.

Filter a string to match a first name

Parameters:
name - the first name to filter
Returns:
the filtered public given name
Throws:
CharacterUnacceptedException - thrown if an rejected character is encountered during analysis

filterGivenName

public static String filterGivenName(String oldValue)
                              throws CharacterUnacceptedException
Filter a string to match a givenName

Parameters:
oldValue - the value to filter
Returns:
the filtered givenname
Throws:
CharacterUnacceptedException - thrown if an rejected character is encountered during analysis

filterAlpha

public static String filterAlpha(String value)
                          throws CharacterUnacceptedException
Filter all alphanumeric characters.

Parameters:
value - the original value
Returns:
the filtered string
Throws:
CharacterUnacceptedException - thrown if an rejected character is encountered during analysis

generatePwd

public static String generatePwd()
Generate a 8 chars long password

Returns:
Le mot de passe

filterName

public static String filterName(String aString)
Remove trailing and starting spaces and replace remaining spaces and dots by dashes

Parameters:
aString - the string to filter
Returns:
the filtered string

filterString

@Deprecated
public static String filterString(String aString)
Deprecated. because it is a simple wrapper for a Java method

Trim a string

Parameters:
aString - the string to filter
Returns:
the filtered string

filterNumber

public static String filterNumber(String value)
                           throws CharacterUnacceptedException
Filters numerical identifier.

Parameters:
value - the string
Returns:
the normalized String
Throws:
CharacterUnacceptedException - launch if and only if the argument is not a numerical identifier

filterDate

public static String filterDate(String value,
                                String format)
                         throws CharacterUnacceptedException
Converts Date into timestamp string.

Parameters:
value - A string representation fo a date
format - The format of Date with representation used by SimpleDateFormat
Returns:
String A string containing correspondant timestamp
Throws:
CharacterUnacceptedException - thrown if an rejected character is encountered during analysis


Copyright © 2005-2010 LSC project. All Rights Reserved.