Deutsch English Français Italiano |
<vida8m$186cp$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Alan Grunwald <nospam.nurdglaw@gmail.com> Newsgroups: comp.lang.tcl Subject: Parsing namespace name strings Date: Fri, 29 Nov 2024 21:03:25 +0000 Organization: A noiseless patient Spider Lines: 19 Message-ID: <vida8m$186cp$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 29 Nov 2024 22:04:22 +0100 (CET) Injection-Info: dont-email.me; posting-host="571940df4d643858c6882180094191ef"; logging-data="1317273"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18snX7est+b5oLXHs0OHbVUbyvCKK0Rpio=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:bPGfXZ4qGPhTqLHNCX/dWVClSdc= Content-Language: en-US Bytes: 1653 I find I regularly want to know things like "what is first part of a namespace name", "the first two parts" etc. I generally want to get the same answer whether the name is a::b::c or ::a::b::c. I can (and do) do this by getting a list of parts via something like split [string map {"::" ":"} $name] ":" but this is clunky - is there something like [namespace split] that would return a list of parts? For example, I'd like namespace split a::b::c to return {a b c}, and namespace split ::d::e::f::g to return {d e f g}. As a followup, if I write a proc namespaceSplit that does what I want, is there a user-level way to modify the [namespace] command so that a can execute namespaceSplit via [namespace split]? Many thanks