In beforeSave, afterSave, … is there a way to determine and act upon all the number attributes? Or string attributes? Or required attributes? You get the idea of what I’d like to be able to do, identify attribute by their rule and then perform an action, str_replace, …
What is your goal?
Because this should usually be solved by rules themselves. Give a look at Filter core validator.
If this won’t solve your problem, I’d suggest you to create a Trait with the transformations you’d like to perform, attach it to the model and call the trait transformations on beforeSave, afterSave, or wherever needed.