how do I trim an email input address so only the d

2019-08-04 03:22发布

问题:

I am using coldfusion 9 to add data into a MySQL database from a form.

I would like to create a username from the email address inputed into the form.

for example,

<cfset store_user_email = EMAILADDRESS>
<cfset store_username = trim EMAILADDRESS before the @>

I'm not sure how to trim down the email address?

Any help would be much appreciated.

回答1:

<cfset store_username = trim(listFirst(EMAILADDRESS,"@"))>