If ist not about storing many bnicks / bmasks, I'd suggest to use a simple addtok.
set %banstring $addtok(%banstring,$+($iif(($bnick),$bnick,-none-),$chr(44),$bmask),32)
this will produce a single variable %banstring.
e.G. there was:
mode # +b Nick1!user@*
mode # +b *!*@93754.telecomitalia.com
mode # +b Nick2!*@*.ipt.aol.com
The data will look like:
Nick1,Nick1!user@* -none-,*!*@93754.telecomitalia.com Nick2,Nick2!*@*.ipt.aol.com
Please note that "$bnick" is $null if a ban contains no nickname at all. Therefore I used that $iif(($bnick),$bnick,-none-)
To parse data, use token identifiers, eg:
grab the 3nd bnick: $gettok($gettok(%banstring,3,32),1,44)
grab the 2nd bmask: $gettok($gettok(%bansgring,2,32),2,44)
delete the first bnick-bmask in the var: set %banstring $deltok($banstring,1,32)