[gen] Added a validator for String fields, for validating Belgian NISS numbers.
This commit is contained in:
parent
369e41b43c
commit
05292356e7
2 changed files with 25 additions and 1 deletions
|
@ -227,12 +227,19 @@ def normalizeString(s, usage='fileName'):
|
|||
res = s
|
||||
return res
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
def normalizeText(s):
|
||||
'''Normalizes p_s: remove special chars, lowerizes it, etc, for indexing
|
||||
purposes.'''
|
||||
return normalizeString(s, usage='extractedText').strip().lower()
|
||||
|
||||
def keepDigits(s):
|
||||
'''Returns string p_s whose non-number chars have been removed.'''
|
||||
if s is None: return s
|
||||
res = ''
|
||||
for c in s:
|
||||
if c.isdigit(): res += c
|
||||
return res
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
def formatNumber(n, sep=',', precision=2, tsep=' '):
|
||||
'''Returns a string representation of number p_n, which can be a float
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue