how do I trim an email input address so only the data before the @ is inputted into the database?

蓝咒 提交于 2019-12-13 01:13:39

问题


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,"@"))>


来源:https://stackoverflow.com/questions/6775360/how-do-i-trim-an-email-input-address-so-only-the-data-before-the-is-inputted-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!