Parses a string.
Category: | Data Quality |
DQ.PARSE(string, string)
definition
a string representing the parsed data
returns
the number of tokens
string
the input string to be parsed into tokens
The DQ.PARSE function parses the input string into tokens. The first parameter is the name of the QKB parse definition. The second parameter is the string from which the tokens are parsed. This returns the number of tokens created. It returns 0 if it fails.
dq dataq
string output
integer o
integer i
/* Initialize DQ */
dataq = dq_initialize()
dataq.loadqkb("EN")
/* Parse (using QKB CI 2013A) */
o = dataq.parse("Name", "Mr. John Q Public Sr")
/* print all of the tokens available */
print (o & " tokens filled")
for i = 1 to o
begin
dataq.token(i, output)
print ("token #" & i & " = " & output)
dataq.value(i, output)
print ("value #" & i & " = " & output)
end
/* Get a token value by the name. */
dataq.tokenvalue("Given Name", output)
print ("Given Name= " & output)