Is there a way to trim only the leading and trailing spaces from a field? I have a Name field, which I later split so I can generate using just the first name, using the rawValue.split method. This way I can generate an e-mail that says Dear John, instead of Dear John Smith by pulling from that field. The problem I have encountered there is that sometimes the person typing the name leaves a leading space before the name, so the e-mail gets generated with no name (so it says "Dear ,". Any help is greatly appreciated.
↧