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

16
LINES

< > BotCompany Repo | #1024501 // ai_parsePersonHeightStatement

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2613L/17K).

1  
sS ai_parsePersonHeightStatement(S input) null on exception {
2  
  Pair<Int> numbers = listToPair(map parseInt(regexpFirstGroupsIC("(\\d+)\\D+(\\d+)", input)));
3  
  if (numbers != null) {
4  
    int a, b = unpair numbers;
5  
    if (a >= 5 && a <= 6 && b >= 0 && b <= 11)
6  
      ret a + " foot " + b;
7  
    else if (a >= 1 && a <= 2 && b >= 0 && b <= 99)
8  
      ret a + "," + formatInt(b, 2) + " m";
9  
  }
10  
  
11  
  int cm = parseFirstInt(input);
12  
  if (cm >= 100 && cm <= 250)
13  
    ret "Aha, you are " + cm + " cm";
14  
    
15  
  null;
16  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024501
Snippet name: ai_parsePersonHeightStatement
Eternal ID of this version: #1024501/1
Text MD5: 052a6a4064fec451c9ad161a093b64c9
Transpilation MD5: b59b345a9d387333ad414dd1219f7bba
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-15 13:53:12
Source code size: 522 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 229 / 300
Referenced in: [show references]