diff --git a/email.js b/email.js new file mode 100755 index 0000000..ef77a14 --- /dev/null +++ b/email.js @@ -0,0 +1,13 @@ +#!/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}'); + diff --git a/hello.js b/hello.js new file mode 100755 index 0000000..ee447f7 --- /dev/null +++ b/hello.js @@ -0,0 +1,5 @@ +#!/usr/bin/env js +s = "Hello, world!"; +for (var i=0; i