namespace split

Difference between version 0 and 0 - Previous - Next
`[namespace] split`, an additional command for working with namespaces, splits
a [namespace%|%qualified name] into its components.



** See Also **

   [ycl%|%ycl ns split]:   An implementation of `namespace split`, as described below.



** Description **

'''`[namespace] split`''' can be trivially implemented using `[ycl%|%ycl
regsplit]`:

======
package require {ycl string}
namespace import [yclprefix]::string::regsplit

proc nssplit ns {
    regsplit ::* ns
    lmap {val delim} $ns[set ns {}] {
        lindex $val
    }
}

======


example:

======
puts [nssplit {::one::two three::::four::five::}]
# -> {} one {two three} four five {}
======



<<categories>> namespace