Newer
Older
2023-seima / email.js
@《suto seima》 《suto seima》 on 6 Oct 372 bytes ファイルを修正しました。
#!/usr/bin/env js
var email = " hogehoge@example.com  \n";
print(email);
email = email.trim();
print(email);
var atpos = email.indexOf('@');
  var localpart = "", domainpart ="";
  if (atpos >= 0 && atpos == email.lastIndexOf('@')) {
    localpart  = email.substring(0, atpos);
    domainpart =  email.substr(atpos+1);
  }
print(`local=${localpart}, dom=${domainpart}`);