#!/usr/bin/env js

var email = " hogehoge@example.com  \n";
print(email);
email = email.trim();
print(email);

var bunri = email.search("@");
var localpart = email.slice(0, bunri);
var domainpart = email.substring(bunri);
if (bunri >= 0 && bunri == email.lastIndexOf("@")) {
    localpart  = email.substring(0, bunri);
    domainpart =  email.substr(bunri+1);
}
print(`local=${localpart}, dom=${domainpart}`);
