Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > BotCompany Repo | #1003576 // gmailGetHandle

JavaX fragment (include)

1  
// s = mail address or gmail handle
2  
sS gmailGetHandle(S s) {
3  
  if (empty(s)) ret s;
4  
  int i = s.indexOf('@');
5  
  if (i < 0) ret s.toLowerCase();
6  
  S a = s.substring(0, i), b = s.substring(i+1);
7  
  if (eqicOneOf(b, "gmail.com", "googlemail.com"))
8  
    ret a.toLowerCase();
9  
  fail("Not a gmail address: " + s);
10  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003576
Snippet name: gmailGetHandle
Eternal ID of this version: #1003576/3
Text MD5: a2c38546ed7f84ec681507e9ae843dc5
Author: stefan
Category: javax / gmail bot
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-03-01 19:19:23
Source code size: 316 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 570 / 633
Version history: 2 change(s)
Referenced in: [show references]