Libraryless. Click here for Pure Java version (1635L/11K/37K).
!752 p{ makeBot("Unit converter bot"); } answer{ if(matchStart("* * to *", s, m)){ double num = Double.parseDouble(m.unq(0)); S from = m.unq(1); S to = m.unq(2); if(from == "c" && to == "f"){ Double result = (num * 1.8) + 32; ret "" + result; } if(from == "f" && to == "c"){ Double result = (num - 32) / 1.8; ret "" + result; } if(from == "m"){ if(to == "mm"){ Double result = num * 1000; ret "" + result; } if(to == "cm"){ Double result = num * 100; ret "" + result; } if(to == "dm"){ Double result = num * 10; ret "" + result; } if(to == "dam"){ Double result = num / 10; ret "" + result; } if(to == "hm"){ Double result = num / 100; ret "" + result; } if(to == "km"){ Double result = num / 1000; ret "" + result; } } } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002331 |
Snippet name: | Unit converter bot |
Eternal ID of this version: | #1002331/1 |
Text MD5: | d6da1d5a0d83167a15168aff1127f8ba |
Transpilation MD5: | 5a57ee2583adb63bcbaafb2576224094 |
Author: | bgrgndz |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-01-06 19:34:28 |
Source code size: | 1005 bytes / 47 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 761 / 1588 |
Referenced in: | [show references] |