NativeString.hx 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package java;
  23. import haxe.Int64;
  24. import haxe.extern.Rest;
  25. import java.StdTypes.Int8;
  26. import java.StdTypes.Char16;
  27. import java.lang.CharSequence;
  28. import java.util.Locale;
  29. @:native("java.lang.String")
  30. extern class NativeString {
  31. function charAt(index:Int):Char16;
  32. function codePointAt(index:Int):Int;
  33. function codePointBefore(index:Int):Int;
  34. function codePointCount(beginIndex:Int, endIndex:Int):Int;
  35. function compareTo(anotherString:String):Int;
  36. function compareToIgnoreCase(str:String):Int;
  37. function concat(str:String):String;
  38. function contains(s:CharSequence):Bool;
  39. @:overload function contentEquals(cs:CharSequence):Bool;
  40. @:overload function contentEquals(sb:java.lang.StringBuffer):Bool;
  41. @:overload static function copyValueOf(data:NativeArray<Char16>):String;
  42. @:overload static function copyValueOf(data:NativeArray<Char16>, offset:Int, count:Int):String;
  43. function endsWith(suffix:String):Bool;
  44. function equals(anObject:Dynamic):Bool;
  45. function equalsIgnoreCase(anotherString:String):Bool;
  46. @:overload static function format(l:Locale, format:String, args:Rest<Dynamic>):String;
  47. @:overload static function format(format:String, args:Rest<Dynamic>):String;
  48. @:overload function getBytes():NativeArray<Int8>;
  49. @:overload function getBytes(charset:java.nio.charset.Charset):NativeArray<Int8>;
  50. @:deprecated @:overload function getBytes(srcBegin:Int, srcEnd:Int, dst:NativeArray<Int8>, dstBegin:Int):Void;
  51. @:overload function getBytes(charsetName:String):NativeArray<Int8>;
  52. function getChars(srcBegin:Int, srcEnd:Int, dst:NativeArray<Char16>, dstBegin:Int):Void;
  53. function hashCode():Int;
  54. @:overload function indexOf(ch:Int):Int;
  55. @:overload function indexOf(ch:Int, fromIndex:Int):Int;
  56. @:overload function indexOf(str:String):Int;
  57. @:overload function indexOf(str:String, fromIndex:Int):Int;
  58. function intern():String;
  59. function isEmpty():Bool;
  60. @:overload function lastIndexOf(ch:Int):Int;
  61. @:overload function lastIndexOf(ch:Int, fromIndex:Int):Int;
  62. @:overload function lastIndexOf(str:String):Int;
  63. @:overload function lastIndexOf(str:String, fromIndex:Int):Int;
  64. function length():Int;
  65. function matches(regex:String):Bool;
  66. function offsetByCodePoints(index:Int, codePointOffset:Int):Int;
  67. @:overload function regionMatches(ignoreCase:Bool, toffset:Int, other:String, ooffset:Int, len:Int):Bool;
  68. @:overload function regionMatches(toffset:Int, other:String, ooffset:Int, len:Int):Bool;
  69. @:overload function replace(oldChar:Char16, newChar:Char16):String;
  70. @:overload function replace(target:CharSequence, replacement:CharSequence):String;
  71. function replaceAll(regex:String, replacement:String):String;
  72. function replaceFirst(regex:String, replacement:String):String;
  73. @:overload function split(regex:String):NativeArray<String>;
  74. @:overload function split(regex:String, limit:Int):NativeArray<String>;
  75. @:overload function startsWith(prefix:String):Bool;
  76. @:overload function startsWith(prefix:String, toffset:Int):Bool;
  77. function subSequence(beginIndex:Int, endIndex:Int):CharSequence;
  78. @:overload function substring(beginIndex:Int):String;
  79. @:overload function substring(beginIndex:Int, endIndex:Int):String;
  80. function toCharArray():NativeArray<Char16>;
  81. @:overload function toLowerCase():String;
  82. @:overload function toLowerCase(locale:Locale):String;
  83. function toString():String;
  84. @:overload function toUpperCase():String;
  85. @:overload function toUpperCase(locale:Locale):String;
  86. function trim():String;
  87. @:overload static function valueOf(b:Bool):String;
  88. @:overload static function valueOf(c:Char16):String;
  89. @:overload static function valueOf(data:NativeArray<Char16>):String;
  90. @:overload static function valueOf(data:NativeArray<Char16>, offset:Int, count:Int):String;
  91. @:overload static function valueOf(d:Float):String;
  92. @:overload static function valueOf(f:String):String;
  93. @:overload static function valueOf(i:Int):String;
  94. @:overload static function valueOf(l:haxe.Int64):String;
  95. @:overload static function valueOf(obj:java.lang.Object):String;
  96. }