It worked, thanks! I haven't used many custom functions before, so I didn't know had to use the objName.functionName format to call it. So I set it up like below, in the Exit event, because if I left it without the if statement and then typed something, exited the field, and came back to delete it, it would add "null" (in actual text) to the field. Please let me know if you see anything I need to fix.
// remove leading and trailing spaces
if (this.rawValue != null) {
this.rawValue = objSpaceTrim.trim(this.rawValue);
}