hasUpper = true; while (++s < end && (enc.isAlnum(name[s] & 0xff) || name[s] == (byte)'_')) { if (enc.isLower(name[s] & 0xff)) hasLower = true; do { code = name[s] & 0xff; if (enc.isLower(code)) hasLower = true; if (enc.isUpper(code)) hasUpper = true; } while (++s < end && (!hasLower || !hasUpper)); if (enc.isLower(code)) constName[s] = AsciiTables.ToUpperCaseTable[code]; for (; s < constName.length; ++s) { if (!enc.isAlnum(constName[s] & 0xff)) constName[s] = (byte)'_'; for (s = 0; s < constName.length; ++s) { code = constName[s] & 0xff; if (enc.isLower(code)) constName[s] = AsciiTables.ToUpperCaseTable[code];
hasUpper = true; while (++s < end && (enc.isAlnum(name[s] & 0xff) || name[s] == (byte)'_')) { if (enc.isLower(name[s] & 0xff)) hasLower = true; do { code = name[s] & 0xff; if (enc.isLower(code)) hasLower = true; if (enc.isUpper(code)) hasUpper = true; } while (++s < end && (!hasLower || !hasUpper)); if (enc.isLower(code)) constName[s] = AsciiTables.ToUpperCaseTable[code]; for (; s < constName.length; ++s) { if (!enc.isAlnum(constName[s] & 0xff)) constName[s] = (byte)'_'; for (s = 0; s < constName.length; ++s) { code = constName[s] & 0xff; if (enc.isLower(code)) constName[s] = AsciiTables.ToUpperCaseTable[code];
hasUpper = true; while (++s < end && (enc.isAlnum(name[s] & 0xff) || name[s] == (byte)'_')) { if (enc.isLower(name[s] & 0xff)) hasLower = true; do { code = name[s] & 0xff; if (enc.isLower(code)) hasLower = true; if (enc.isUpper(code)) hasUpper = true; } while (++s < end && (!hasLower || !hasUpper)); if (enc.isLower(code)) constName[s] = AsciiTables.ToUpperCaseTable[code]; for (; s < constName.length; ++s) { if (!enc.isAlnum(constName[s] & 0xff)) constName[s] = (byte)'_'; for (s = 0; s < constName.length; ++s) { code = constName[s] & 0xff; if (enc.isLower(code)) constName[s] = AsciiTables.ToUpperCaseTable[code];
hasUpper = true; while (++s < end && (enc.isAlnum(name[s] & 0xff) || name[s] == (byte)'_')) { if (enc.isLower(name[s] & 0xff)) hasLower = true; do { code = name[s] & 0xff; if (enc.isLower(code)) hasLower = true; if (enc.isUpper(code)) hasUpper = true; } while (++s < end && (!hasLower || !hasUpper)); if (enc.isLower(code)) constName[s] = AsciiTables.ToUpperCaseTable[code]; for (; s < constName.length; ++s) { if (!enc.isAlnum(constName[s] & 0xff)) constName[s] = (byte)'_'; for (s = 0; s < constName.length; ++s) { code = constName[s] & 0xff; if (enc.isLower(code)) constName[s] = AsciiTables.ToUpperCaseTable[code];
private IRubyObject multiByteSwapcase(Ruby runtime, Encoding enc, byte[]bytes, int s, int end) { boolean modify = false; while (s < end) { int c = codePoint(runtime, enc, bytes, s, end); if (enc.isUpper(c)) { enc.codeToMbc(toLower(enc, c), bytes, s); modify = true; } else if (enc.isLower(c)) { enc.codeToMbc(toUpper(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c); } return modify ? this : runtime.getNil(); }
private IRubyObject multiByteSwapcase(Ruby runtime, Encoding enc, byte[]bytes, int s, int end) { boolean modify = false; while (s < end) { int c = codePoint(runtime, enc, bytes, s, end); if (enc.isUpper(c)) { enc.codeToMbc(toLower(enc, c), bytes, s); modify = true; } else if (enc.isLower(c)) { enc.codeToMbc(toUpper(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c); } return modify ? this : runtime.getNil(); }
private IRubyObject multiByteUpcase(Ruby runtime, Encoding enc, byte[]bytes, int s, int end) { boolean modify = false; int c; while (s < end) { if (enc.isAsciiCompatible() && Encoding.isAscii(c = bytes[s] & 0xff)) { if (ASCII.isLower(c)) { bytes[s] = AsciiTables.ToUpperCaseTable[c]; modify = true; } s++; } else { c = codePoint(runtime, enc, bytes, s, end); if (enc.isLower(c)) { enc.codeToMbc(toUpper(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c); } } return modify ? this : runtime.getNil(); }
private IRubyObject multiByteUpcase(Ruby runtime, Encoding enc, byte[]bytes, int s, int end) { boolean modify = false; int c; while (s < end) { if (enc.isAsciiCompatible() && Encoding.isAscii(c = bytes[s] & 0xff)) { if (ASCII.isLower(c)) { bytes[s] = AsciiTables.ToUpperCaseTable[c]; modify = true; } s++; } else { c = codePoint(runtime, enc, bytes, s, end); if (enc.isLower(c)) { enc.codeToMbc(toUpper(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c); } } return modify ? this : runtime.getNil(); }
@JRubyMethod(name = "capitalize!", compat = RUBY1_9) public IRubyObject capitalize_bang19(ThreadContext context) { Ruby runtime = context.runtime; Encoding enc = checkDummyEncoding(); if (value.getRealSize() == 0) { modifyCheck(); return runtime.getNil(); } modifyAndKeepCodeRange(); int s = value.getBegin(); int end = s + value.getRealSize(); byte[]bytes = value.getUnsafeBytes(); boolean modify = false; int c = codePoint(runtime, enc, bytes, s, end); if (enc.isLower(c)) { enc.codeToMbc(toUpper(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c); while (s < end) { c = codePoint(runtime, enc, bytes, s, end); if (enc.isUpper(c)) { enc.codeToMbc(toLower(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c); } return modify ? this : runtime.getNil(); }
@JRubyMethod(name = "capitalize!", compat = RUBY1_9) public IRubyObject capitalize_bang19(ThreadContext context) { Ruby runtime = context.runtime; Encoding enc = checkDummyEncoding(); if (value.getRealSize() == 0) { modifyCheck(); return runtime.getNil(); } modifyAndKeepCodeRange(); int s = value.getBegin(); int end = s + value.getRealSize(); byte[]bytes = value.getUnsafeBytes(); boolean modify = false; int c = codePoint(runtime, enc, bytes, s, end); if (enc.isLower(c)) { enc.codeToMbc(toUpper(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c); while (s < end) { c = codePoint(runtime, enc, bytes, s, end); if (enc.isUpper(c)) { enc.codeToMbc(toLower(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c); } return modify ? this : runtime.getNil(); }