Hi, my name is Dirk and I am new here.
Hopefully we can help each other out.
My problem:
Input is house numbers like '10', '11b', '12 - c', '12/2' and I would like the output split in two output lines like this:
'10' = '10' and NULL
'11b' = '11' and 'b'
'12 - c' = '12' and '- c'
'12/2' = '12' and '/2'
So the first line gets the number untill the first occurence of a non-numeric value.
The second line gets al the characters from the first non-numeric value till the end of the string.
I have been puzzling with Alnum, Alpha and Index but I couldn't resolve.
Can anybody help me?
How to get string from VarChar from first non-numeric value
Moderators: chulett, rschirm, roy
I am sure there is a better way but you could do the following (not sure it would work in all circumstances)
Have 3 stage variables:
Basically what it is doing is
svConvert: Converts all the numbers to blank
svPart1: Uses whatever is left from the input string as a delimiter, and selects the first part of the input string based on that delimiter. If there was nothing left after the numbers are converted then it outputs the input string (as it must have been all numbers)
svPart2: Uses the output of svPart1 (ie the first part of the numbers) as a delimiter, and selects the remaining parts of the input string based on that delimiter. If there was nothing left after the numbers were converted to blank it outputs blank.
Have 3 stage variables:
Code: Select all
svConvert=Convert('1234567890','', Lnk_input.STRING)
svPart1=If svConvert ='' then Lnk_input.STRING else Lnk_input.STRING[svConvert,1,1]
svPart2=If svConvert ='' then '' else Lnk_input.STRING[svPart1,2,99]
svConvert: Converts all the numbers to blank
svPart1: Uses whatever is left from the input string as a delimiter, and selects the first part of the input string based on that delimiter. If there was nothing left after the numbers are converted then it outputs the input string (as it must have been all numbers)
svPart2: Uses the output of svPart1 (ie the first part of the numbers) as a delimiter, and selects the remaining parts of the input string based on that delimiter. If there was nothing left after the numbers were converted to blank it outputs blank.