sclass CIString implements Comparable<CIString>, CharSequence { char[] data; // could be final except for persistence *() {} *(char[] s) { data = String.valueOf(assertNotNull(s)); } *(S s) { data = toCharArray(s); } // note that eq(s, cistring) is still false public bool equals(Object o) { if (o cast CIString) ret eqicCharArrays(data, o.data); /*if (o instanceof String) // One-way interoperability! return s.equalsIgnoreCase((String) o);*/ false; } public int compareTo(CIString cis) { ret compareCharArraysIC(data, cis.data); } toString { ret str(data); } public char charAt(int index) { ret data[index]; } public int length() { ret data.length; } public CharSequence subSequence(int start, int end) { ret CIString(subCharArray(data, start, end)); } }
Began life as a copy of #1002873
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027854 |
Snippet name: | CIString - case insensitive string, compact version 1 [dev.] |
Eternal ID of this version: | #1027854/1 |
Text MD5: | ee12bd5946455debb3fdd98c7de99e98 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-04-15 19:08:42 |
Source code size: | 857 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 174 / 206 |
Referenced in: | -