I need to construct a unique plantcode given the botanical plantname
Handy when importing in bulk from different sources to avoid duplicates
IE
botanical name Code
Anemone ×hybrida ‘Honorine Jobert’ = ANHHJOBE
Anemone ×hybrida ‘Alba’ = ANHALBA
Anemone japonica alba = ANJALBA
Anemone hupehensis ‘Praecox’ = ANHPRAEC
Anemone ‘Praecox’ = ANPRAECO
Anemone nemorosa =ANNEMORO
Pseudocode
C#= Count the words from the botanical name
Case C#
of 2 !There are always at least 2 words
if 2e word start with ' or x
Upper(substract,1,2,botanical name)&Upper(substract,2,6,2e word)
else
Upper(substract,1,2,botanical name )&Upper(substract,1,5,2e word)
end
of 3
if 2e word start with x and 3e word start with '
Upper(substract,1,2,botanical name)&Upper(substract,2,1,2e word)&Upper(substract,2,5,3e word)
else
Upper(substract,1,2,botanical name)&Upper(substract,1,1,2e word)&Upper(substract,2,5,3e word)
end
of >3
if 2e word start with x and 3e word start with '
Upper(substract,1,2,botanical name)&Upper(substract,2,1,2e word)&Upper(substract,2,1,3e word)&Upper(substract,1,4,4e word)
else
Upper(substract,1,2,botanical name)&Upper(substract,1,1,2e word)&Upper(substract,2,1,3e word)&Upper(substract,1,4,4e word)
end
end !case
Can anybody help to check this and change this into stringtheory code