我有一个类似procedure VSTBeforeCellPaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas;
Node: PVirtualNode; Column: TColumnIndex; CellPaintMode: TVTCellPaintMode;
CellRect: TRect; var ContentRect: TRect);
begin
if (CellPaintMode = cpmPaint) and (Node = vstStrom.HotNode) then
begin
TargetCanvas.Brush.Color := clGreen;
TargetCanvas.FillRect(CellRect);
end;
end;
的地图,并且想要将其键转换为字符串,例如{:a "A" :b "B"}
。
我有此功能,可以正常工作:
{"a" "A" "b" "B"}
但是还有更惯用的或专用的方法吗?
谢谢!
答案 0 :(得分:8)
有一个内置函数可以将映射键递归转换为字符串:
(clojure.walk/stringify-keys {:a "A" :b "B"})
=> {"a" "A", "b" "B"}
(clojure.walk/stringify-keys {:a "A" :b {:c "C"}})
=> {"a" "A", "b" {"c" "C"}}