• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

De-concatenate a hierarchical list of text strings?

jaboo

New Member
Hi, I need to do a substitute (or similar) operation to de-concatenate a very long list of records. This data is a concatenated hierarchical list of category names, but the separator used is not the same throughout. Sometimes " - ", sometimes " -" sometimes "-" (where a dash also appears normally in the concatenated strings, so I can't just split on that).

What I need to do is compare each row with the previous row, and remove the text at the beginning of the string that exactly and completely matches the previous row. However this test needs to be done in reverse order (I think) so that each comparison will be made on the current value, not the fixed value. Then
I would move any preceding spaces or dashes. Any thoughts on this? Thanks

edit: now that I say that about "reverse order" - that won't work. I think it needs to go in forward order and compare the current value with every subsequent value, make the changes, then start over until there are no matches. Not sure of best way to do this.

Code:
Hand tools
Hand tools -Spades; Shovels
Hand tools -Spades; Shovels -Collapsible; extensible; combinations with other tools
Hand tools -Spades; Shovels -Foot protectors attached to the blade
Hand tools -Spades; Shovels -with auxiliary handles for facilitating lifting
Hand tools -Spades; Shovels -with ground abutment shoes or earth anchors for facilitating lifting
Hand tools -Spades; Shovels -with teeth
Hand tools -Hoes; Hand cultivators
Hand tools -Hoes; Hand cultivators -powered
Hand tools -Hoes; Hand cultivators -with a single blade
Hand tools -Hoes; Hand cultivators -with two or more blades
Hand tools -Hoes; Hand cultivators -with blades provided with teeth
Hand tools -Hoes; Hand cultivators -with teeth only
Hand tools -Tools for uprooting weeds
Hand tools -Tools for uprooting weeds-adapted for extracting a substantially cylindrical plug out of the earth
Hand tools -Tools for uprooting weeds-Tong-like tools
Hand tools -Combinations of different kinds of hand tools
Hand tools -Attaching the blades or the like to handles ; Interchangeable or adjustable blades
Hand tools -Attaching the blades or the like to handles ; Interchangeable or adjustable blades-Adjustable blades
Hand tools -Attaching the blades or the like to handles ; Interchangeable or adjustable blades-Adjustable blades-around a substantially horizontal axis
Hand tools -Attaching the blades or the like to handles ; Interchangeable or adjustable blades-Interchangable blades
Hand tools -for treating meadows or lawns
Hand tools -for treating meadows or lawns-for aerating
Hand tools -for treating meadows or lawns-for cutting sods or turves
Ploughs with fixed plough-shares
Ploughs with fixed plough-shares-Man-driven ploughs
Ploughs with fixed plough-shares-Animal-drawn ploughs
 
Last edited:
Back
Top