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

13
LINES

< > TinyBrain | #1008018 - U - string stored as UTF-8

JavaX fragment (include)

static class U implements Comparable<U> {
  byte[] data;
  
  *() {}
  *(byte[] *data) {}
  *(S s) { data = toUtf8(s); }
  
  toString { ret fromUtf8(data); }
  
  public int compareTo(U u) {
    ret u == null ? 1 : toString().compareTo(u.toString());
  }
}

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

No comments. add comment

Snippet ID: #1008018
Snippet name: U - string stored as UTF-8
Eternal ID of this version: #1008018/5
Text MD5: b7a8fa98669e4a65bf3beac894f5eb65
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-20 18:41:21
Source code size: 269 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 10 / 48
Version history: 4 change(s)
Referenced in: [show]