/** * This comparison matches MRI comparison of Strings (rb_str_cmp). * I wish we had memcmp right now... */ public int compareTo(Object other) { return cmp((ByteList)other); }
/** * This comparison matches MRI comparison of Strings (rb_str_cmp). * I wish we had memcmp right now... */ public int compareTo(Object other) { return cmp((ByteList)other); }
/** * This comparison matches MRI comparison of Strings (rb_str_cmp). * I wish we had memcmp right now... */ public int compareTo(Object other) { return cmp((ByteList)other); }
/** rb_str_cmp * */ public int op_cmp(RubyString other) { return value.cmp(other.value); }
/** rb_str_cmp * */ public final int op_cmp(RubyString other) { return value.cmp(other.value); }
/** rb_str_cmp * */ public final int op_cmp(RubyString other) { return value.cmp(other.value); }
/** rb_str_cmp * */ public final int op_cmp(RubyString other) { int ret = value.cmp(other.value); if (ret == 0 && !StringSupport.areComparable(this, other)) { return value.getEncoding().getIndex() > other.value.getEncoding().getIndex() ? 1 : -1; } return ret; }
public final int op_cmp19(RubyString other) { int ret = value.cmp(other.value); if (ret == 0 && !isComparableWith(other)) { return value.getEncoding().getIndex() > other.value.getEncoding().getIndex() ? 1 : -1; } return ret; }
public final int op_cmp19(RubyString other) { int ret = value.cmp(other.value); if (ret == 0 && !isComparableWith(other)) { return value.getEncoding().getIndex() > other.value.getEncoding().getIndex() ? 1 : -1; } return ret; }
/** rb_str_cmp * */ public final int op_cmp(RubyString other) { int ret = value.cmp(other.value); if (ret == 0 && !StringSupport.areComparable(this, other)) { return value.getEncoding().getIndex() > other.value.getEncoding().getIndex() ? 1 : -1; } return ret; }
public IRubyObject upto(ThreadContext context, IRubyObject str, boolean excl, Block block) { RubyString end = str.convertToString(); int n = value.cmp(end.value); if (n > 0 || (excl && n == 0)) return this; IRubyObject afterEnd = end.callMethod(context, "succ"); RubyString current = this; while (!current.op_equal(context, afterEnd).isTrue()) { block.yield(context, current); if (!excl && current.op_equal(context, end).isTrue()) break; current = current.callMethod(context, "succ").convertToString(); if (excl && current.op_equal(context, end).isTrue()) break; if (current.value.realSize > end.value.realSize || current.value.realSize == 0) break; } return this; }