src/jdk/nashorn/internal/objects/NativeString.java

changeset 118
927fba6785b0
parent 114
508da3c7fc3a
child 133
5759f600fcf7
equal deleted inserted replaced
117:5452f82eb2ce 118:927fba6785b0
639 */ 639 */
640 @Function(attributes = Attribute.NOT_ENUMERABLE) 640 @Function(attributes = Attribute.NOT_ENUMERABLE)
641 public static Object localeCompare(final Object self, final Object that) { 641 public static Object localeCompare(final Object self, final Object that) {
642 642
643 final String str = checkObjectToString(self); 643 final String str = checkObjectToString(self);
644 final Collator collator = Collator.getInstance(Global.getThisContext().getLocale()); 644 final Collator collator = Collator.getInstance(Global.getEnv()._locale);
645 645
646 collator.setStrength(Collator.IDENTICAL); 646 collator.setStrength(Collator.IDENTICAL);
647 collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION); 647 collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
648 648
649 return (double)collator.compare(str, JSType.toString(that)); 649 return (double)collator.compare(str, JSType.toString(that));
994 * @param self self reference 994 * @param self self reference
995 * @return string to locale sensitive lower case 995 * @return string to locale sensitive lower case
996 */ 996 */
997 @Function(attributes = Attribute.NOT_ENUMERABLE) 997 @Function(attributes = Attribute.NOT_ENUMERABLE)
998 public static Object toLocaleLowerCase(final Object self) { 998 public static Object toLocaleLowerCase(final Object self) {
999 return checkObjectToString(self).toLowerCase(Global.getThisContext().getLocale()); 999 return checkObjectToString(self).toLowerCase(Global.getEnv()._locale);
1000 } 1000 }
1001 1001
1002 /** 1002 /**
1003 * ECMA 15.5.4.18 String.prototype.toUpperCase ( ) 1003 * ECMA 15.5.4.18 String.prototype.toUpperCase ( )
1004 * @param self self reference 1004 * @param self self reference
1014 * @param self self reference 1014 * @param self self reference
1015 * @return string to locale sensitive upper case 1015 * @return string to locale sensitive upper case
1016 */ 1016 */
1017 @Function(attributes = Attribute.NOT_ENUMERABLE) 1017 @Function(attributes = Attribute.NOT_ENUMERABLE)
1018 public static Object toLocaleUpperCase(final Object self) { 1018 public static Object toLocaleUpperCase(final Object self) {
1019 return checkObjectToString(self).toUpperCase(Global.getThisContext().getLocale()); 1019 return checkObjectToString(self).toUpperCase(Global.getEnv()._locale);
1020 } 1020 }
1021 1021
1022 /** 1022 /**
1023 * ECMA 15.5.4.20 String.prototype.trim ( ) 1023 * ECMA 15.5.4.20 String.prototype.trim ( )
1024 * @param self self reference 1024 * @param self self reference

mercurial