<div dir="ltr">Hi,<div><br></div><div>Could you suggest how to do this in Catmandu:</div><div><br></div><div>I need to form a new MARC field ("400") that consist of some subfields (in this order: $a $q $b $c $d) of an existing field ("100"). That much is not difficult, but there's another condition:</div><div><br></div><div>"." must be added to the last subfield that exists (e.g. if $d exists append "." to it unless it already ends with ".", otherwise do the same with $c, [...]) .</div><div><br></div><div>Questions:</div><div> </div><div>1) how to determine if a field (e.g. fld_100d created via marc_map) ends with "." ?</div><div><br></div><div>2) is there a way to "package" some functionality and call it when needed?</div><div><br></div><div>In this case it would be good to create a function that appends "." to the field provided as a parameter unless it already ends with ".".</div><div><br></div><div>Then what is needed could be achieved like this:</div><div><br></div><div>if exists("fld_100d"):</div><div>   my_function("fld_100d")</div><div>elsif exists("fld_100c"):</div><div>   my_function("fld_100c")</div><div>elsif [...]</div><div>   [...]</div><div>end</div><div><br></div><div>P.S. Perhaps there is a more idiomatic way how to do this in Catmandu?</div><div><br></div><div>Thanks,</div><div>Uldis</div><div><br></div></div>