1 package SnowMailClient.view.traceView; 2 3 public class TraceItem 4 { 5 String content; 6 String from = ""; 7 String by = ""; 8 String For = ""; 9 String date = ""; 10 11 public TraceItem(String content) 12 { 13 this.content = content; 14 15 String contUP = content.toUpperCase(); 16 17 int posFrom = contUP.indexOf("FROM"); 18 if(posFrom!=-1) 19 { 20 from = content.substring(posFrom+4); 21 int posEnd = from.indexOf("\n"); 22 if(posEnd!=-1) from = from.substring(0,posEnd); 23 } 24 25 int posBy = contUP.indexOf("BY"); 26 if(posBy!=-1) 27 { 28 by = content.substring(posBy+2); 29 int posEnd = by.indexOf("\n"); 30 if(posEnd!=-1) by = by.substring(0,posEnd); 31 } 32 33 int posFor = contUP.indexOf("FOR"); 34 if(posFor!=-1) 35 { 36 For = content.substring(posFor+3); 37 int posEnd = For.indexOf(";"); 38 if(posEnd!=-1) 39 { 40 For = For.substring(0,posEnd); 41 } 42 } 43 44 int posDate = content.indexOf(";"); 45 if(posDate!=-1) 46 { 47 date = content.substring(posDate+1).trim(); 48 } 49 50 } 52 public String getContent() { return content; } 53 public String getFrom() { return from; } 54 public String getBy() { return by; } 55 public String getFor() { return For; } 56 public String getDate() { return date; } 57 58 59 60 61 } | Popular Tags |