Replacing Characters in column names

Hello,

I have referred to this link http://stackoverflow.com/questions/21895949/kdb-q-column-name-with-spaces

but I’m trying to create my own similar func to replace ‘$’ and ‘%’ characters in the column name instead of removing them.  I’ve tried this but I’m not sure why I’m getting type error.  Does anyone know?

rndollar:{`$(ssr[x;“$”;“Dollar”])each string

cleancols:rndollar cols@

cleancols xcol x:table

in table I have a couple columns like “Price $ Change” and “Price % Change” and I want to rename to something like PriceDollarChangePricePercentChange

rndollar (“Price $ Change”;“Price % Change”;“Price”)

`type

Thanks!

Hi Roni,

It’ll work if you tweak your function to something like this:

q)rndollar:{`$ssr[;" $ ";“Dollar”]each string x}

q)rndollar `$(“Price $ Change”;“Price % Change”;“Price”)

PriceDollarChangePrice % Change`Price

Regards,

Paul

Got it.  Thanks very much