Mercurial > projects > dwt-mac
comparison dwt/dwthelper/utils.d @ 139:86fc761a24ae
Fixes #11
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Thu, 04 Jun 2009 23:23:10 +0200 |
parents | 623ff6db5f1d |
children |
comparison
equal
deleted
inserted
replaced
138:3d9eb62cd2e3 | 139:86fc761a24ae |
---|---|
553 | 553 |
554 String new_String (String cont){ | 554 String new_String (String cont){ |
555 return cont.dup; | 555 return cont.dup; |
556 } | 556 } |
557 | 557 |
558 wchar[] new_String( wchar[] cont, int offset, int len ){ | |
559 return cont[ offset .. offset+len ].dup; | |
560 } | |
561 | |
562 wchar[] new_String (wchar[] cont){ | |
563 return cont.dup; | |
564 } | |
565 | |
558 public String toUpperCase( String str ){ | 566 public String toUpperCase( String str ){ |
559 return tango.text.Unicode.toUpper( str ); | 567 return tango.text.Unicode.toUpper( str ); |
560 } | 568 } |
561 | 569 |
562 /*public int indexOf( String str, char searched ){ | 570 /*public int indexOf( String str, char searched ){ |
636 | 644 |
637 public wchar[] toCharArray( String str ){ | 645 public wchar[] toCharArray( String str ){ |
638 return toString16( str ); | 646 return toString16( str ); |
639 } | 647 } |
640 | 648 |
649 public String fromString16( wchar[] str ){ | |
650 return toString( str ); | |
651 } | |
652 | |
653 public char toChar(wchar c){ | |
654 return [c].toString()[0]; | |
655 } | |
656 | |
657 public wchar toWChar(char c){ | |
658 return [c].toString16()[0]; | |
659 } | |
660 | |
641 public bool endsWith( String src, String pattern ){ | 661 public bool endsWith( String src, String pattern ){ |
642 if( src.length < pattern.length ){ | 662 if( src.length < pattern.length ){ |
643 return false; | 663 return false; |
644 } | 664 } |
645 return src[ $-pattern.length .. $ ] == pattern; | 665 return src[ $-pattern.length .. $ ] == pattern; |
646 } | 666 } |
647 | 667 |
648 public bool equals( String src, String other ){ | 668 public bool equals( String src, String other ){ |
669 return src == other; | |
670 } | |
671 | |
672 public bool equals( wchar[] src, wchar[] other ){ | |
649 return src == other; | 673 return src == other; |
650 } | 674 } |
651 | 675 |
652 public bool equalsIgnoreCase( String src, String other ){ | 676 public bool equalsIgnoreCase( String src, String other ){ |
653 return tango.text.Unicode.toFold(src) == tango.text.Unicode.toFold(other); | 677 return tango.text.Unicode.toFold(src) == tango.text.Unicode.toFold(other); |