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

12
LINES

< > BotCompany Repo | #1004488 // aToAn - convert "a" to "an" where appropriate anywhere in string

JavaX fragment (include)

1  
static S aToAn(S s) {
2  
  ret jreplaceIC(s, "a", "an", new O {
3  
    bool get(L<S> tok, int i) {
4  
      S w = _get(tok, i+3);
5  
      if (w == null) false;
6  
      w = toLower(unquote(w));
7  
      if (empty(w)) false;
8  
      if (startsWith(w, "x ")) true; // what?
9  
      ret contains("aeiou", w.charAt(0)); // rough
10  
    }
11  
  });
12  
}

Author comment

Began life as a copy of #1004475

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004488
Snippet name: aToAn - convert "a" to "an" where appropriate anywhere in string
Eternal ID of this version: #1004488/6
Text MD5: 1df3ee8463253deba19b681b6182362e
Author: stefan
Category: javax / talking robots
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-24 01:41:01
Source code size: 328 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 564 / 568
Version history: 5 change(s)
Referenced in: [show references]