Package org.jruby
Class RubyString
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyString
- All Implemented Interfaces:
Serializable,CharSequence,Cloneable,Comparable<IRubyObject>,Appendable,InstanceVariables,InternalVariables,IRubyObject,EncodingCapable,MarshalEncoding,CoreObjectType,ByteListHolder,CodeRangeable
- Direct Known Subclasses:
RubyString.FString
public class RubyString
extends RubyObject
implements CharSequence, EncodingCapable, MarshalEncoding, CodeRangeable, Appendable
Implementation of Ruby String class
Concurrency: no synchronization is required among readers, but
all users must synchronize externally with writers.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classEncoding aware String construction routines for 1.9static classAn FString is a frozen string that is also deduplicated and cached.Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.DataNested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer -
Field Summary
FieldsFields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORFields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStamp -
Constructor Summary
ConstructorsModifierConstructorDescriptionRubyString(Ruby runtime, RubyClass rubyClass) RubyString(Ruby runtime, RubyClass rubyClass, byte[] value) RubyString(Ruby runtime, RubyClass rubyClass, CharSequence value) RubyString(Ruby runtime, RubyClass rubyClass, CharSequence value, org.jcodings.Encoding enc) RubyString(Ruby runtime, RubyClass rubyClass, ByteList value) RubyString(Ruby runtime, RubyClass rubyClass, ByteList value, boolean objectSpace) protectedRubyString(Ruby runtime, RubyClass rubyClass, ByteList value, int cr) protectedRubyString(Ruby runtime, RubyClass rubyClass, ByteList value, int cr, boolean objectspace) protectedRubyString(Ruby runtime, RubyClass rubyClass, ByteList value, org.jcodings.Encoding enc) RubyString(Ruby runtime, RubyClass rubyClass, ByteList value, org.jcodings.Encoding encoding, boolean objectSpace) protectedRubyString(Ruby runtime, RubyClass rubyClass, ByteList value, org.jcodings.Encoding enc, int cr) -
Method Summary
Modifier and TypeMethodDescriptionappend(RubyString other) append(IRubyObject other) append(IRubyObject other, Function<IRubyObject, RubyString> convert) rb_str_appendappend_as_bytes(ThreadContext context) append_as_bytes(ThreadContext context, IRubyObject arg0) append_as_bytes(ThreadContext context, IRubyObject[] args) append19(IRubyObject other) Deprecated.appendAsDynamicString(IRubyObject other) appendAsStringOrAny(IRubyObject other) voidappendIntoString(RubyString target) ascii_only_p(ThreadContext context) rb_to_idvoidassociateEncoding(org.jcodings.Encoding enc) asString()rb_obj_as_string First converts this object into a String using the "to_s" method and returns it.b(ThreadContext context) byteindex(ThreadContext context, IRubyObject arg0) byteindex(ThreadContext context, IRubyObject arg0, IRubyObject arg1) static StringbyteListToString(ByteList bytes) byterindex(ThreadContext context, IRubyObject arg0) byterindex(ThreadContext context, IRubyObject arg0, IRubyObject arg1) bytes(ThreadContext context, Block block) bytesize()Deprecated.bytesize(ThreadContext context) byteslice(ThreadContext context, IRubyObject arg) byteslice(ThreadContext context, IRubyObject arg1, IRubyObject arg2) bytesplice(ThreadContext context, IRubyObject[] args) bytesplice(ThreadContext context, IRubyObject arg0, IRubyObject arg1) bytesplice(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) static StringbytesToString(byte[] bytes) static StringbytesToString(byte[] bytes, int beg, int len) intcapacity()Determine how much space exists after the begin offset in this string's buffer.capitalize(ThreadContext context) rb_str_capitalize / rb_str_capitalize_bangcapitalize(ThreadContext context, IRubyObject arg) capitalize(ThreadContext context, IRubyObject arg0, IRubyObject arg1) capitalize_bang(ThreadContext context) capitalize_bang(ThreadContext context, IRubyObject arg) capitalize_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1) casecmp(ThreadContext context, IRubyObject other) casecmp_p(ThreadContext context, IRubyObject other) final RubyStringcat(byte ch) final RubyStringcat(byte[] str) final RubyStringcat(byte[] str, int beg, int len) final intcat(byte[] bytes, int p, int len, org.jcodings.Encoding enc) final RubyStringcat(int ch) final RubyStringcat(int code, org.jcodings.Encoding enc) final RubyStringcat(RubyString str) final RubyStringfinal RubyStringfinal RubyStringcat19(RubyString str2) Deprecated.final intDeprecated.final RubyStringcatAscii(byte[] bytes, int ptr, int ptrLen) final RubyStringfinal RubyStringcatStringUnsafe(String str) Append a Java String to this RubyString assuming it will be the encoding of the RubyString.final RubyStringcatWithCodeRange(RubyString str2) final intcatWithCodeRange(ByteList other, int codeRange) center(IRubyObject arg0) Deprecated.center(IRubyObject arg0, IRubyObject arg1) Deprecated.center(ThreadContext context, IRubyObject arg0) rb_str_centercenter(ThreadContext context, IRubyObject arg0, IRubyObject arg1) charcharAt(int offset) chars(ThreadContext context, Block block) static org.jcodings.EncodingcheckEncoding(Ruby runtime, ByteList str1, ByteList str2) final org.jcodings.EncodingcheckEncoding(RubyString other) final org.jcodings.EncodingcheckEncoding(CodeRangeable other) voidThe actual method that checks frozen with the default frozen message from MRI.rb_check_string_type Tries to return a coerced string representation of this object, using "to_str".chill()chomp(ThreadContext context) rb_str_chomp_bang In the common case, removes CR and LF characters in various ways depending on the value of the optional args[0].chomp(ThreadContext context, IRubyObject arg0) chomp_bang(ThreadContext context) chomp_bang(ThreadContext context, IRubyObject arg0) chomp_bang19(ThreadContext context) Deprecated.chomp_bang19(ThreadContext context, IRubyObject arg0) Deprecated.chomp19(ThreadContext context) Deprecated.chomp19(ThreadContext context, IRubyObject arg0) Deprecated.chop(ThreadContext context) rb_str_chop / rb_str_chop_bangchop_bang(ThreadContext context) chr(ThreadContext context) clear()Deprecated.clear(ThreadContext context) final voidcodepoints(ThreadContext context, Block block) final intcompareTo(IRubyObject other) Compares this Ruby object with another.concat(IRubyObject other) concat(ThreadContext context, IRubyObject obj) rb_str_concatconcat(ThreadContext context, IRubyObject[] objs) rb_str_concat_multiconcatSingle(ThreadContext context, IRubyObject other) rb_str_concatTries to convert this object to a Ruby String using the "to_str" method.count(ThreadContext context) count(ThreadContext context, IRubyObject arg) count(ThreadContext context, IRubyObject[] args) static RubyClasscreateStringClass(ThreadContext context, RubyClass Object, RubyModule Comparable) crypt(ThreadContext context, IRubyObject other) rb_str_cryptConvert this Ruby string to a Java String.delete(ThreadContext context) rb_str_delete / rb_str_delete_bangdelete(ThreadContext context, IRubyObject arg) delete(ThreadContext context, IRubyObject[] args) delete_bang(ThreadContext context) delete_bang(ThreadContext context, IRubyObject arg) delete_bang(ThreadContext context, IRubyObject[] args) delete_prefix(ThreadContext context, IRubyObject prefix) delete_prefix_bang(ThreadContext context, IRubyObject prefix) delete_suffix(ThreadContext context, IRubyObject suffix) delete_suffix_bang(ThreadContext context, IRubyObject suffix) doClone()downcase(ThreadContext context) rb_str_downcase / rb_str_downcase_bangdowncase(ThreadContext context, IRubyObject arg) downcase(ThreadContext context, IRubyObject arg0, IRubyObject arg1) downcase_bang(ThreadContext context) downcase_bang(ThreadContext context, IRubyObject arg) downcase_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1) dump()Deprecated.dump(ThreadContext context) rb_str_dumpdup()Overridden dup for fast-path logic.dup(ThreadContext context) RubyMethod dup.final RubyStringdupAsChilled(Ruby runtime, RubyClass clazz, String file, int line) dupAsFString(Ruby runtime) each_byte(ThreadContext context, Block block) rb_str_each_byteeach_char(ThreadContext context, Block block) each_codepoint(ThreadContext context, Block block) rb_str_each_codepointeach_grapheme_cluster(ThreadContext context, Block block) each_line(ThreadContext context, Block block) rb_str_each_lineeach_line(ThreadContext context, IRubyObject arg, Block block) each_line(ThreadContext context, IRubyObject arg, IRubyObject opts, Block block) each_lineCommon(ThreadContext context, IRubyObject sep, Block block) Deprecated.voidempty()empty_p(ThreadContext context) rb_str_emptyencode(ThreadContext context) encode(ThreadContext context, IRubyObject arg) encode(ThreadContext context, IRubyObject toEncoding, IRubyObject arg) encode(ThreadContext context, IRubyObject toEncoding, IRubyObject forcedEncoding, IRubyObject opts) encode_bang(ThreadContext context) encode_bang(ThreadContext context, IRubyObject arg0) encode_bang(ThreadContext context, IRubyObject[] args) Deprecated.encode_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1) encode_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) static ByteListencodeBytelist(CharSequence value, org.jcodings.Encoding encoding) encoding(ThreadContext context) encStrScrub(ThreadContext context, org.jcodings.Encoding enc, IRubyObject repl, int cr, Block block) encStrScrub(ThreadContext context, org.jcodings.Encoding enc, IRubyObject repl, Block block) end_with_p(ThreadContext context) end_with_p(ThreadContext context, IRubyObject arg) end_with_p(ThreadContext context, IRubyObject[] args) booleanendsWithAsciiChar(char c) protected booleanendWith(IRubyObject tmp) voidensureAvailable(ThreadContext context, int extraLength) Ensure the backing store belongs to this string and has enough space to add extraLength bytes.final voidMakes sure that instance variables can be set on this object, including information about whether this object is frozen.final booleaneql(IRubyObject other) short circuit for String key comparisonbooleanThis override does not do a "checked" dispatch.export(ThreadContext context) force_encoding(ThreadContext context, IRubyObject enc) freeze(ThreadContext context) protected voidgetbyte(ThreadContext context, IRubyObject index) Get the ByteList which backs this Ruby Stringbyte[]getBytes()final intgetEmptyByteList(org.jcodings.Encoding enc) org.jcodings.EncodingWill return the Java interface that most closely can represent this object, when working through Java integration translations.org.jcodings.EncodingThis is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.used by ar-jdbcgetValue()grapheme_clusters(ThreadContext context, Block block) gsub(ThreadContext context, IRubyObject arg0, Block block) gsub(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) gsub_bang(ThreadContext context, IRubyObject arg0, Block block) gsub_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) gsubFast(ThreadContext context, RubyRegexp regexp, RubyString repl, Block block) hash(ThreadContext context) Will return the hash code of this object.inthashCode()This override does not do "checked" dispatch since Object usually has #hash defined.booleanhasNul()Does this string contain \0 anywhere (per byte search).hex(ThreadContext context) rb_str_hexinclude_p(ThreadContext context, IRubyObject obj) rb_str_includestatic IRubyObjectincludeRange(ThreadContext context, RubyString _beg, RubyString _end, IRubyObject _val, boolean exclusive) final booleanindex(ThreadContext context, IRubyObject arg0) rb_str_index_mindex(ThreadContext context, IRubyObject arg0, IRubyObject arg1) initialize(ThreadContext context) initialize(ThreadContext context, IRubyObject arg0) initialize(ThreadContext context, IRubyObject arg0, IRubyObject opts) initialize_copy(IRubyObject other) Deprecated.initialize_copy(ThreadContext context, IRubyObject other) Initializes this object as a copy of the original, that is the parameter to this object.insert(ThreadContext context, IRubyObject indexArg, IRubyObject arg) inspect()Deprecated.static RubyStringDeprecated.inspect(ThreadContext context) rb_str_inspectstatic RubyStringinspect(ThreadContext context, ByteList byteList) intern()Deprecated.intern(ThreadContext context) final booleanbooleanDeprecated.booleanisBare(ThreadContext context) Is this a "bare" string, i.e.final booleanprotected booleanprotected booleanfinal booleanfinal booleanfinal booleanbooleanisEmpty()final voidintlength()lines(ThreadContext context, Block block) lines(ThreadContext context, IRubyObject arg, Block block) lines(ThreadContext context, IRubyObject arg, IRubyObject opts, Block block) ljust(IRubyObject arg0) Deprecated.ljust(IRubyObject arg0, IRubyObject arg1) Deprecated.ljust(ThreadContext context, IRubyObject arg0) rb_str_ljustljust(ThreadContext context, IRubyObject arg0, IRubyObject arg1) lstrip(ThreadContext context) rb_str_lstrip / rb_str_lstrip_banglstrip_bang(ThreadContext context) final RubyStringfinal RubyStringmakeIndependent(int length) final RubyStringmakeShared(Ruby runtime, int index, int len) final RubyStringmakeShared(Ruby runtime, RubyClass meta, int index, int len) final RubyStringmakeSharedString(Ruby runtime, int index, int len) match(ThreadContext context, IRubyObject pattern) Deprecated.match(ThreadContext context, IRubyObject[] args, Block block) match(ThreadContext context, IRubyObject pattern, Block block) match(ThreadContext context, IRubyObject pattern, IRubyObject pos, Block block) match_p(ThreadContext context, IRubyObject pattern) match_p(ThreadContext context, IRubyObject pattern, IRubyObject pos) match19(ThreadContext context, IRubyObject pattern) Deprecated.match19(ThreadContext context, IRubyObject[] args, Block block) Deprecated.match19(ThreadContext context, IRubyObject pattern, IRubyObject pos, Block block) Deprecated.final IRubyObjectminus_at(ThreadContext context) final voidmodify()final voidmodify(int length) rb_str_modify (with length bytes ensured)final voidmodify19()Deprecated.final voidvoidfinal voidCheck that the string can be modified, raising error otherwise.voidmodifyCheck(byte[] b, int len) final voidmodifyExpand(int length) rb_str_modify_expandprotected voidstatic RubyStringnewAllocatedString(Ruby runtime, RubyClass metaClass) static RubyStringnewBinaryString(Ruby runtime, String str) static RubyStringnewBinaryString(Ruby runtime, ByteList str) static RubyStringnewChilledString(Ruby runtime, ByteList bytes, int coderange, String file, int line) static RubyStringnewDebugChilledString(Ruby runtime, RubyClass rubyClass, ByteList value, int cr, String file, int line) static RubyStringnewDebugFrozenString(Ruby runtime, RubyClass rubyClass, ByteList value, int cr, String file, int line) static RubyStringnewEmptyBinaryString(Ruby runtime) static RubyStringnewEmptyString(Ruby runtime) static RubyStringnewEmptyString(Ruby runtime, org.jcodings.Encoding enc) static RubyStringnewEmptyString(Ruby runtime, RubyClass metaClass) static RubyStringnewEmptyString(Ruby runtime, RubyClass metaClass, org.jcodings.Encoding enc) static RubyStringnewExternalStringWithEncoding(Ruby runtime, String string, org.jcodings.Encoding encoding) Deprecated.static RubyStringnewFString(Ruby runtime, String content) Create anew or deduplicate a RubyString based on the given Java String content.static RubyStringnewInstance(IRubyObject recv, IRubyObject[] args, Block block) rb_str_s_newstatic RubyStringnewInternalFromJavaExternal(Ruby runtime, String str) Return a new Ruby String encoded as the default internal encoding given a Java String that has come from an external source.Deprecated.static RubyStringstatic RubyStringstatic RubyStringstatic RubyStringnewString(Ruby runtime, CharSequence str) static RubyStringnewString(Ruby runtime, CharSequence str, org.jcodings.Encoding encoding) static RubyStringstatic RubyStringstatic RubyStringnewString(Ruby runtime, RubyClass clazz, CharSequence str) Deprecated.static RubyStringstatic RubyStringstatic RubyStringDeprecated.static RubyStringnewStringLight(Ruby runtime, int size) static RubyStringnewStringLight(Ruby runtime, int size, org.jcodings.Encoding encoding) static RubyStringnewStringLight(Ruby runtime, ByteList bytes) static RubyStringnewStringNoCopy(Ruby runtime, byte[] bytes) static RubyStringnewStringNoCopy(Ruby runtime, byte[] bytes, int start, int length) static RubyStringnewStringNoCopy(Ruby runtime, byte[] bytes, int start, int length, org.jcodings.Encoding encoding) static RubyStringnewStringNoCopy(Ruby runtime, RubyClass clazz, ByteList bytes) static RubyStringnewStringNoCopy(Ruby runtime, RubyClass clazz, ByteList bytes, org.jcodings.Encoding enc, int cr) static RubyStringnewStringNoCopy(Ruby runtime, ByteList bytes) static RubyStringnewStringNoCopy(Ruby runtime, ByteList bytes, org.jcodings.Encoding enc, int cr) static RubyStringnewStringShared(Ruby runtime, byte[] bytes) Deprecated.static RubyStringnewStringShared(Ruby runtime, byte[] bytes, int start, int length) Deprecated.static RubyStringnewStringShared(Ruby runtime, byte[] bytes, int start, int length, org.jcodings.Encoding encoding) static RubyStringnewStringShared(Ruby runtime, byte[] bytes, org.jcodings.Encoding encoding) Deprecated.static RubyStringnewStringShared(Ruby runtime, RubyClass clazz, ByteList bytes) static RubyStringnewStringShared(Ruby runtime, RubyClass clazz, ByteList bytes, org.jcodings.Encoding encoding) static RubyStringnewStringShared(Ruby runtime, RubyString orig) static RubyStringnewStringShared(Ruby runtime, ByteList bytes) static RubyStringnewStringShared(Ruby runtime, ByteList bytes, int codeRange) static RubyStringnewStringShared(Ruby runtime, ByteList bytes, org.jcodings.Encoding encoding) static RubyStringnewUnicodeString(Ruby runtime, CharSequence str) static RubyStringnewUnicodeString(Ruby runtime, String str) static RubyStringnewUSASCIIString(Ruby runtime, String str) static RubyStringnewUsAsciiStringNoCopy(Ruby runtime, ByteList bytes) static RubyStringnewUsAsciiStringShared(Ruby runtime, byte[] bytes, int start, int length) static RubyStringnewUsAsciiStringShared(Ruby runtime, ByteList bytes) static RubyStringnewUTF16String(Ruby runtime, CharSequence str) static RubyStringnewUTF16String(Ruby runtime, String str) static RubyStringnewUTF8String(Ruby runtime, CharSequence str) static RubyStringnewUTF8String(Ruby runtime, String str) static RubyStringobjAsString(ThreadContext context, IRubyObject obj) rb_obj_as_stringoct(ThreadContext context) rb_str_octop_aref(ThreadContext context, IRubyObject arg) rb_str_aref, rb_str_aref_mop_aref(ThreadContext context, IRubyObject arg1, IRubyObject arg2) op_aset(ThreadContext context, IRubyObject arg0, IRubyObject arg1) rb_str_aset, rb_str_aset_mop_aset(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) final intop_cmp(RubyString other) rb_str_cmpop_cmp(ThreadContext context, IRubyObject other) op_equal(ThreadContext context, IRubyObject other) rb_str_equalop_format(ThreadContext context, IRubyObject arg) op_ge(ThreadContext context, IRubyObject other) op_ge19(ThreadContext context, IRubyObject other) Deprecated.op_gt(ThreadContext context, IRubyObject other) op_gt19(ThreadContext context, IRubyObject other) Deprecated.op_le(ThreadContext context, IRubyObject other) op_le19(ThreadContext context, IRubyObject other) Deprecated.op_lt(ThreadContext context, IRubyObject other) op_lt19(ThreadContext context, IRubyObject other) Deprecated.op_match(ThreadContext context, IRubyObject other) rb_str_matchop_mul(ThreadContext context, IRubyObject other) op_mul19(ThreadContext context, IRubyObject other) Deprecated.op_plus(ThreadContext context, IRubyObject arg) op_plus19(ThreadContext context, IRubyObject arg) Deprecated.ord(ThreadContext context) partition(ThreadContext context, Block block) partition(ThreadContext context, IRubyObject arg, Block block) final IRubyObjectplus_at()Deprecated.final IRubyObjectplus_at(ThreadContext context) final RubyStringprepend(byte ch) final RubyStringprepend(int ch) prepend(ThreadContext context, IRubyObject other) rb_str_prependprepend(ThreadContext context, IRubyObject[] objs) rb_str_prependstatic IRubyObjectrbStrEscape(ThreadContext context, RubyString str) intrbStrOffset(int pos) replace(IRubyObject other) Deprecated.replace(ThreadContext context, IRubyObject other) rb_str_replace_mreplace19(IRubyObject other) Deprecated.final voidresize(int size) rb_str_resizereverse(ThreadContext context) reverse_bang(ThreadContext context) reverse_bang19(ThreadContext context) Deprecated.reverse19(ThreadContext context) Deprecated.rindex(ThreadContext context, IRubyObject arg0) rb_str_rindex_mrindex(ThreadContext context, IRubyObject arg0, IRubyObject arg1) rjust(IRubyObject arg0) Deprecated.rjust(IRubyObject arg0, IRubyObject arg1) Deprecated.rjust(ThreadContext context, IRubyObject arg0) rb_str_rjustrjust(ThreadContext context, IRubyObject arg0, IRubyObject arg1) rpartition(ThreadContext context, IRubyObject arg) rstrip(ThreadContext context) rb_str_rstrip / rb_str_rstrip_bangrstrip_bang(ThreadContext context) rubyLength(ThreadContext context) scan(ThreadContext context, IRubyObject pat, Block block) rb_str_scanfinal intstatic intscanForCodeRange(ByteList bytes) scrub(ThreadContext context, Block block) scrub(ThreadContext context, IRubyObject repl, Block block) scrub_bang(ThreadContext context, Block block) scrub_bang(ThreadContext context, IRubyObject repl, Block block) setbyte(ThreadContext context, IRubyObject index, IRubyObject val) final voidfinal voidsetCodeRange(int codeRange) voidsetEncoding(org.jcodings.Encoding encoding) final voidsetEncodingAndCodeRange(org.jcodings.Encoding enc, int cr) voidsetReadLength(int length) voidsetValue(CharSequence value) Deprecated.voidbooleansingletonClass(ThreadContext context) Will either return the existing singleton class for this object, or create a new one and return that.intsize()slice_bang(ThreadContext context, IRubyObject arg0) rb_str_slice_bangslice_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1) split(RubyRegexp delimiter) Deprecated.split(RubyRegexp delimiter, int limit) Deprecated.split(RubyString delimiter) Deprecated.split(RubyString delimiter, int limit) Deprecated.split(ThreadContext context) split(ThreadContext context, RubyRegexp delimiter, int limit) Split for ext (Java) callers (does not write $~).split(ThreadContext context, RubyString delimiter, int limit) Split for ext (Java) callers (does not write $~).split(ThreadContext context, IRubyObject arg0) split(ThreadContext context, IRubyObject pattern, IRubyObject limit) splitWithBlock(ThreadContext context, Block block) rb_str_split_msplitWithBlock(ThreadContext context, IRubyObject arg0, Block block) splitWithBlock(ThreadContext context, IRubyObject pattern, IRubyObject limit, Block block) squeeze(ThreadContext context) rb_str_squeeze / rb_str_squeeze_bangsqueeze(ThreadContext context, IRubyObject arg) squeeze(ThreadContext context, IRubyObject[] args) squeeze_bang(ThreadContext context) squeeze_bang(ThreadContext context, IRubyObject arg) squeeze_bang(ThreadContext context, IRubyObject[] args) start_with_p(ThreadContext context) start_with_p(ThreadContext context, IRubyObject arg) start_with_p(ThreadContext context, IRubyObject[] args) booleanstartsWith(RubyString str) str_eql_p(ThreadContext context, IRubyObject other) str_eql_p19(ThreadContext context, IRubyObject other) Deprecated.final RubyStringstrDup()Deprecated.final RubyStringfinal RubyStringintstrHashCode(Ruby runtime) Generate a hash for the String, using its associated Ruby instance's hash seed.static byte[]stringToBytes(String string) final IRubyObjectstringToInum(int base) stringToInum(int base, boolean badcheck) rb_str_to_inumstatic RubyStringstringValue(IRubyObject object) strip(ThreadContext context) rb_str_strip / rb_str_strip_bangstrip_bang(ThreadContext context) final intstrScrub(ThreadContext context, IRubyObject repl, Block block) Scrub the contents of this string, replacing invalid characters as appropriate.sub(ThreadContext context, IRubyObject arg0, Block block) rb_str_sub / rb_str_sub_bangsub(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) sub_bang(ThreadContext context, IRubyObject arg0, Block block) sub_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) final IRubyObjectsubBangFast(ThreadContext context, RubyRegexp regexp, RubyString repl) sub! but without any frame globals ...subSequence(int start, int end) final IRubyObjectsubstr(int beg, int len) Deprecated.final IRubyObjectDeprecated.final IRubyObjectsubstr(ThreadContext context, int beg, int len) final IRubyObjectDeprecated.final IRubyObjectDeprecated.final IRubyObjectsubstrEnc(ThreadContext context, int beg, int len) succ(ThreadContext context) Deprecated.succ_bang(ThreadContext context) sum(ThreadContext context) sum(ThreadContext context, IRubyObject arg) sumCommon(ThreadContext context, long bits) swapcase(ThreadContext context) rb_str_swapcase / rb_str_swapcase_bangswapcase(ThreadContext context, IRubyObject arg) swapcase(ThreadContext context, IRubyObject arg0, IRubyObject arg1) swapcase_bang(ThreadContext context) swapcase_bang(ThreadContext context, IRubyObject arg) swapcase_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1) to_c(ThreadContext context) string_to_cto_f()Deprecated.to_f(ThreadContext context) to_i()Deprecated.to_i(IRubyObject arg0) Deprecated.to_i(ThreadContext context) to_i(ThreadContext context, IRubyObject arg0) rb_str_to_ito_r(ThreadContext context) string_to_rto_s(ThreadContext context) final org.jcodings.EncodingtoEncoding(Ruby runtime) Deprecated.<T> TConvert the object to the specified Java class, if possible.toString()The default toString method is just a wrapper that calls the Ruby "to_s" method.tr(ThreadContext context, IRubyObject src, IRubyObject repl) rb_str_tr / rb_str_tr_bangtr_bang(ThreadContext context, IRubyObject src, IRubyObject repl) tr_bang19(ThreadContext context, IRubyObject src, IRubyObject repl) Deprecated.tr_s(ThreadContext context, IRubyObject src, IRubyObject repl) rb_str_tr_s / rb_str_tr_s_bangtr_s_bang(ThreadContext context, IRubyObject src, IRubyObject repl) tr_s_bang19(ThreadContext context, IRubyObject src, IRubyObject repl) Deprecated.tr_s19(ThreadContext context, IRubyObject src, IRubyObject repl) Deprecated.tr19(ThreadContext context, IRubyObject src, IRubyObject repl) Deprecated.static IRubyObjecttry_convert(ThreadContext context, IRubyObject recv, IRubyObject str) undump(ThreadContext context) static RubyStringunmarshalFrom(UnmarshalStream input) Deprecated, for removal: This API element is subject to removal in a future version.static RubyStringunmarshalFrom(ThreadContext context, RubyInputStream in, MarshalLoader input) unpack(IRubyObject obj) Deprecated.unpack(ThreadContext context, IRubyObject obj, Block block) unpack(ThreadContext context, IRubyObject obj, IRubyObject opt, Block block) unpack1(ThreadContext context, IRubyObject obj, Block block) unpack1(ThreadContext context, IRubyObject obj, IRubyObject opt, Block block) intunseededStrHashCode(Ruby runtime) Generate a hash for the String, without a seed.upcase(ThreadContext context) rb_str_upcase / rb_str_upcase_bangupcase(ThreadContext context, IRubyObject arg) upcase(ThreadContext context, IRubyObject arg0, IRubyObject arg1) upcase_bang(ThreadContext context) upcase_bang(ThreadContext context, IRubyObject arg) upcase_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1) final IRubyObjectupto(ThreadContext context, IRubyObject end, Block block) rb_str_upto_mfinal IRubyObjectupto(ThreadContext context, IRubyObject end, IRubyObject excl, Block block) valid_encoding_p(ThreadContext context) voidfinal voidMethods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, dig, dig1, dig2, eqlInternal, equalInternal, finishObjectClass, inspect, op_eqq, puts, specificEval, toRubyStringMethods inherited from class org.jruby.RubyBasicObject
addFinalizer, addFinalizer, anyToString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, cloneSetup, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, copyInstanceVariablesInto, copySpecialInstanceVariables, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dupFinalizer, dupSetup, eql_p, eql_p, equal_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, finishBasicObjectClass, forEachInstanceVariable, forEachInstanceVariableName, frozen_p, getCurrentContext, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getMarshalVariableList, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, makeMetaClass, makeMetaClassBootstrap, method, method, method, method_missing, methods, methods, nil_p, nonFixnumHashCode, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_not, op_not_equal, op_not_match, private_methods, protected_methods, public_methods, rbClone, rbClone, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method, singleton_method_added, singleton_method_removed, singleton_method_undefined, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, to_s, trust, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePointsMethods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, marshalLiveVariables
-
Field Details
-
NULL_ARRAY
-
-
Constructor Details
-
RubyString
-
RubyString
-
RubyString
-
RubyString
-
RubyString
-
RubyString
-
RubyString
-
RubyString
-
RubyString
-
RubyString
-
RubyString
-
-
Method Details
-
createStringClass
public static RubyClass createStringClass(ThreadContext context, RubyClass Object, RubyModule Comparable) -
getEncoding
public org.jcodings.Encoding getEncoding()- Specified by:
getEncodingin interfaceEncodingCapable
-
setEncoding
public void setEncoding(org.jcodings.Encoding encoding) - Specified by:
setEncodingin interfaceEncodingCapable
-
shouldMarshalEncoding
public boolean shouldMarshalEncoding()- Specified by:
shouldMarshalEncodingin interfaceMarshalEncoding
-
getMarshalEncoding
public org.jcodings.Encoding getMarshalEncoding()- Specified by:
getMarshalEncodingin interfaceMarshalEncoding
-
associateEncoding
public void associateEncoding(org.jcodings.Encoding enc) -
setEncodingAndCodeRange
public final void setEncodingAndCodeRange(org.jcodings.Encoding enc, int cr) -
toEncoding
Deprecated. -
getCodeRange
public final int getCodeRange()- Specified by:
getCodeRangein interfaceCodeRangeable
-
setCodeRange
public final void setCodeRange(int codeRange) - Specified by:
setCodeRangein interfaceCodeRangeable
-
clearCodeRange
public final void clearCodeRange()- Specified by:
clearCodeRangein interfaceCodeRangeable
-
keepCodeRange
public final void keepCodeRange()- Specified by:
keepCodeRangein interfaceCodeRangeable
-
isCodeRangeAsciiOnly
public final boolean isCodeRangeAsciiOnly() -
isAsciiOnly
public final boolean isAsciiOnly() -
isCodeRangeValid
public final boolean isCodeRangeValid()- Specified by:
isCodeRangeValidin interfaceCodeRangeable
-
isCodeRangeBroken
public final boolean isCodeRangeBroken() -
isBrokenString
public final boolean isBrokenString() -
scanForCodeRange
public final int scanForCodeRange()- Specified by:
scanForCodeRangein interfaceCodeRangeable
-
scanForCodeRange
-
checkEncoding
-
checkEncoding
- Specified by:
checkEncodingin interfaceCodeRangeable
-
checkEncoding
-
strLength
public final int strLength() -
eql
short circuit for String key comparison- Specified by:
eqlin interfaceIRubyObject- Overrides:
eqlin classRubyBasicObject- Returns:
- Will by default just call the Ruby method "eql?"
-
hasNul
public boolean hasNul()Does this string contain \0 anywhere (per byte search).- Returns:
- true if it does
-
verifyAsciiCompatible
public void verifyAsciiCompatible() -
newString
Deprecated. -
newString
Deprecated. -
newString
Deprecated. -
newStringLight
-
newStringLight
-
newStringLight
-
newString
-
newString
-
newString
-
newString
-
newBinaryString
-
newBinaryString
-
newUSASCIIString
-
newString
-
newString
-
newString
public static RubyString newString(Ruby runtime, byte[] bytes, int start, int length, org.jcodings.Encoding encoding) -
newStringNoCopy
public static RubyString newStringNoCopy(Ruby runtime, byte[] bytes, int start, int length, org.jcodings.Encoding encoding) -
newString
-
newString
-
newChilledString
public static RubyString newChilledString(Ruby runtime, ByteList bytes, int coderange, String file, int line) -
newString
-
newUnicodeString
-
newUTF8String
-
newUTF16String
-
newUnicodeString
-
newUTF8String
-
newUTF16String
-
newInternalFromJavaExternal
Return a new Ruby String encoded as the default internal encoding given a Java String that has come from an external source. If there is no default internal encoding set, the Ruby String will be encoded using Java's default external encoding. If an internal encoding is set, that encoding will be used for the Ruby String.- Parameters:
runtime-str-- Returns:
-
newExternalStringWithEncoding
@Deprecated public static RubyString newExternalStringWithEncoding(Ruby runtime, String string, org.jcodings.Encoding encoding) Deprecated. -
newEmptyString
-
newEmptyBinaryString
-
newAllocatedString
-
newEmptyString
-
newStringNoCopy
-
newStringNoCopy
-
newStringNoCopy
-
newStringNoCopy
-
independent
public final boolean independent() -
makeIndependent
-
makeIndependent
-
export
-
capacity
public int capacity()Determine how much space exists after the begin offset in this string's buffer.- Returns:
- the amount of capacity in this string's buffer after the begin offset
-
getEmptyByteList
-
newEmptyString
public static RubyString newEmptyString(Ruby runtime, RubyClass metaClass, org.jcodings.Encoding enc) -
newEmptyString
-
newStringNoCopy
public static RubyString newStringNoCopy(Ruby runtime, RubyClass clazz, ByteList bytes, org.jcodings.Encoding enc, int cr) -
newStringNoCopy
public static RubyString newStringNoCopy(Ruby runtime, ByteList bytes, org.jcodings.Encoding enc, int cr) -
newUsAsciiStringNoCopy
-
getNativeClassIndex
Description copied from class:RubyObjectThis is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex- Specified by:
getNativeClassIndexin interfaceCoreObjectType- Overrides:
getNativeClassIndexin classRubyObject- Returns:
- the ClassIndex of the native type this object was constructed from
- See Also:
-
getJavaClass
Description copied from class:RubyBasicObjectWill return the Java interface that most closely can represent this object, when working through Java integration translations.- Specified by:
getJavaClassin interfaceIRubyObject- Overrides:
getJavaClassin classRubyBasicObject- Returns:
- the true Java class of this (Ruby) object
-
convertToString
Description copied from class:RubyBasicObjectTries to convert this object to a Ruby String using the "to_str" method.- Specified by:
convertToStringin interfaceIRubyObject- Overrides:
convertToStringin classRubyBasicObject- Returns:
- a string representation of this
-
toString
Description copied from class:RubyObjectThe default toString method is just a wrapper that calls the Ruby "to_s" method.- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classRubyObject- Returns:
- string representation
-
decodeString
Convert this Ruby string to a Java String. This version is encoding-aware.- Returns:
- A decoded Java String, based on this Ruby string's encoding.
-
dup
Overridden dup for fast-path logic.- Specified by:
dupin interfaceIRubyObject- Overrides:
dupin classRubyBasicObject- Returns:
- A new RubyString sharing the original backing store.
-
dupFrozen
-
dup
Description copied from interface:IRubyObjectRubyMethod dup.- Specified by:
dupin interfaceIRubyObject- Parameters:
context- the thread context- Returns:
- a dup-ed object
-
strDup
-
strDup
-
dupAsChilled
-
dupAsFString
-
modifyCheck
public final void modifyCheck()Check that the string can be modified, raising error otherwise. If you plan to modify a string with shared backing store, this method is not sufficient; you will need to call modify() instead. -
modifyCheck
public void modifyCheck(byte[] b, int len) -
frozenCheck
protected void frozenCheck() -
checkFrozen
public void checkFrozen()Description copied from class:RubyBasicObjectThe actual method that checks frozen with the default frozen message from MRI. If possible, call this instead ofRubyBasicObject.testFrozen(java.lang.String).- Overrides:
checkFrozenin classRubyBasicObject
-
ensureInstanceVariablesSettable
public final void ensureInstanceVariablesSettable()Description copied from class:RubyBasicObjectMakes sure that instance variables can be set on this object, including information about whether this object is frozen. Will throw a suitable exception in that case.- Overrides:
ensureInstanceVariablesSettablein classRubyBasicObject
-
mutateChilledString
protected void mutateChilledString() -
isChilled
protected boolean isChilled() -
isChilledLiteral
protected boolean isChilledLiteral() -
modify
public final void modify()- Specified by:
modifyin interfaceByteListHolder
-
modify19
Deprecated. -
modifyAndClearCodeRange
public final void modifyAndClearCodeRange() -
modifyAndKeepCodeRange
public void modifyAndKeepCodeRange()- Specified by:
modifyAndKeepCodeRangein interfaceCodeRangeable
-
modify
public final void modify(int length) rb_str_modify (with length bytes ensured)- Specified by:
modifyin interfaceByteListHolder
-
modifyExpand
public final void modifyExpand(int length) rb_str_modify_expand -
ensureAvailable
Ensure the backing store belongs to this string and has enough space to add extraLength bytes. MRI: str_ensure_available_capa- Parameters:
context- the current thread contextextraLength- the extra length needed
-
setReadLength
public void setReadLength(int length) -
newFString
Create anew or deduplicate a RubyString based on the given Java String content.- Parameters:
runtime- the JRuby runtimecontent- the Java String content- Returns:
- a frozen, deduplicated RubyString hosting the given content
-
newFrozen
-
newDebugFrozenString
public static RubyString newDebugFrozenString(Ruby runtime, RubyClass rubyClass, ByteList value, int cr, String file, int line) -
newDebugChilledString
public static RubyString newDebugChilledString(Ruby runtime, RubyClass rubyClass, ByteList value, int cr, String file, int line) -
resize
public final void resize(int size) rb_str_resize -
view
-
bytesToString
-
byteListToString
-
bytesToString
-
stringToBytes
-
asString
Description copied from class:RubyBasicObjectrb_obj_as_string First converts this object into a String using the "to_s" method and returns it. If to_s doesn't return a Ruby String,RubyBasicObject.anyToString()is used instead.- Specified by:
asStringin interfaceIRubyObject- Overrides:
asStringin classRubyBasicObject- Returns:
- string representation
-
checkStringType
Description copied from class:RubyBasicObjectrb_check_string_type Tries to return a coerced string representation of this object, using "to_str". If that returns something other than a String or nil, an empty String will be returned.- Specified by:
checkStringTypein interfaceIRubyObject- Overrides:
checkStringTypein classRubyBasicObject- Returns:
- nil if type check failed
-
try_convert
-
to_s
- Overrides:
to_sin classRubyBasicObject
-
compareTo
Description copied from class:RubyBasicObjectCompares this Ruby object with another.- Specified by:
compareToin interfaceComparable<IRubyObject>- Overrides:
compareToin classRubyBasicObject- Parameters:
other- another IRubyObject- Returns:
- 0 if equal, < 0 if this is less than other, > 0 if this is greater than other
-
op_cmp
- Overrides:
op_cmpin classRubyBasicObject
-
op_equal
rb_str_equal- Specified by:
op_equalin interfaceIRubyObject- Overrides:
op_equalin classRubyBasicObject
-
minus_at
-
plus_at
Deprecated. -
plus_at
-
op_plus19
Deprecated. -
op_plus
-
op_mul19
Deprecated. -
op_mul
-
op_format
-
hash
Description copied from class:RubyBasicObjectWill return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.- Overrides:
hashin classRubyBasicObject- Parameters:
context- the current thread context- Returns:
- the hash value
-
hashCode
public int hashCode()Description copied from class:RubyObjectThis override does not do "checked" dispatch since Object usually has #hash defined.- Overrides:
hashCodein classRubyObject- Returns:
- the hash code
- See Also:
-
strHashCode
Generate a hash for the String, using its associated Ruby instance's hash seed.- Parameters:
runtime- the runtime- Returns:
- calculated hash
-
unseededStrHashCode
Generate a hash for the String, without a seed.- Parameters:
runtime- the runtime- Returns:
- calculated hash
-
equals
Description copied from class:RubyObjectThis override does not do a "checked" dispatch.- Overrides:
equalsin classRubyObject- Parameters:
other- object to compare- Returns:
- true if equals
- See Also:
-
objAsString
rb_obj_as_string -
op_cmp
rb_str_cmp -
asJavaString
rb_to_id- Specified by:
asJavaStringin interfaceIRubyObject- Overrides:
asJavaStringin classRubyBasicObject- Returns:
- a (Java) string
-
doClone
-
cat
-
cat
-
cat19
Deprecated. -
catWithCodeRange
-
cat
-
cat19
Deprecated. -
catWithCodeRange
-
catStringUnsafe
Append a Java String to this RubyString assuming it will be the encoding of the RubyString. If it is not then then it will end up as an invalid string. Some methods assume an encoding of BINARY so that broken bytes are possible/expected (e.g. an error message with two names which are not compatible to be combined into a single Ruby String). Proc#to_s is an example of this.- Parameters:
str- to be appended- Returns:
- this string after it has appended str
-
catString
-
cat
-
cat
-
cat
-
cat
-
cat
-
cat
public final int cat(byte[] bytes, int p, int len, org.jcodings.Encoding enc) -
catAscii
-
replace19
Deprecated. -
initialize_copy
Deprecated.- Overrides:
initialize_copyin classRubyBasicObject- Parameters:
other- object- Returns:
- a copy
-
initialize_copy
Description copied from class:RubyBasicObjectInitializes this object as a copy of the original, that is the parameter to this object. Will make sure that the argument actually has the same real class as this object. It shouldn't be possible to initialize an object with something totally different.- Overrides:
initialize_copyin classRubyBasicObject- Parameters:
context- the thread contextother- the original- Returns:
- a copy unless the same thing
-
replace
Deprecated. -
replace
rb_str_replace_m -
clear
Deprecated. -
clear
-
reverse19
Deprecated. -
reverse
-
reverse_bang19
Deprecated. -
reverse_bang
-
newInstance
rb_str_s_new -
initialize
- Overrides:
initializein classRubyBasicObject
-
initialize
-
initialize
-
casecmp
-
casecmp_p
-
op_match
rb_str_match- Overrides:
op_matchin classRubyBasicObject- Parameters:
context- the thread contextother- arg- Returns:
- true if matches (always nil)
-
match19
Deprecated. -
match19
@Deprecated public IRubyObject match19(ThreadContext context, IRubyObject pattern, IRubyObject pos, Block block) Deprecated. -
match19
Deprecated. -
match
Deprecated.String#match(pattern) rb_str_match_m- Parameters:
pattern- Regexp or String
-
match
-
match
-
match
-
match_p
-
match_p
-
op_ge19
Deprecated. -
op_ge
-
op_gt19
Deprecated. -
op_gt
-
op_le19
Deprecated. -
op_le
-
op_lt19
Deprecated. -
op_lt
-
str_eql_p19
Deprecated. -
str_eql_p
-
upcase
rb_str_upcase / rb_str_upcase_bang -
upcase
-
upcase
-
upcase_bang
-
upcase_bang
-
upcase_bang
-
downcase
rb_str_downcase / rb_str_downcase_bang -
downcase
-
downcase
-
downcase_bang
-
downcase_bang
-
downcase_bang
-
swapcase
rb_str_swapcase / rb_str_swapcase_bang -
swapcase
-
swapcase
-
swapcase_bang
-
swapcase_bang
-
swapcase_bang
-
capitalize
rb_str_capitalize / rb_str_capitalize_bang -
capitalize
-
capitalize
-
capitalize_bang
-
capitalize_bang
-
capitalize_bang
-
dump
Deprecated. -
dump
rb_str_dump -
undump
-
insert
-
inspect
Deprecated.Description copied from interface:IRubyObjectRubyMethod inspect.- Specified by:
inspectin interfaceIRubyObject- Overrides:
inspectin classRubyBasicObject- Returns:
- String
-
inspect
rb_str_inspect- Specified by:
inspectin interfaceIRubyObject- Overrides:
inspectin classRubyBasicObject
-
rbStrEscape
-
inspect
Deprecated. -
inspect
-
size
public int size() -
rubyLength
-
bytesize
-
bytesize
Deprecated. -
length
public int length()- Specified by:
lengthin interfaceCharSequence
-
charAt
public char charAt(int offset) - Specified by:
charAtin interfaceCharSequence
-
subSequence
- Specified by:
subSequencein interfaceCharSequence
-
empty_p
rb_str_empty -
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCharSequence
-
appendIntoString
- Specified by:
appendIntoStringin interfaceAppendable
-
append
rb_str_append -
append
-
append
-
append19
Deprecated. -
appendAsDynamicString
-
appendAsStringOrAny
-
concatSingle
rb_str_concat -
concat
rb_str_concat -
concat
rb_str_concat_multi -
concat
-
prepend
rb_str_prepend -
prepend
rb_str_prepend -
prepend
-
prepend
-
crypt
rb_str_crypt -
stringValue
-
sub
rb_str_sub / rb_str_sub_bang -
sub
-
sub_bang
-
sub_bang
-
subBangFast
sub! but without any frame globals ...- Parameters:
context- current contextregexp- the regular expressionrepl- replacement string value- Returns:
- sub result
-
gsub
-
gsub
-
gsub_bang
-
gsub_bang
public IRubyObject gsub_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) -
gsubFast
-
index
rb_str_index_m -
index
-
byteindex
-
byteindex
-
rindex
rb_str_rindex_m -
rindex
-
byterindex
-
byterindex
-
substr
Deprecated. -
substr
Deprecated. -
substr
-
substr19
Deprecated. -
substrEnc
Deprecated. -
substrEnc
-
op_aref
rb_str_aref, rb_str_aref_m -
op_aref
-
byteslice
-
byteslice
-
bytesplice
-
bytesplice
-
bytesplice
public IRubyObject bytesplice(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) -
op_aset
rb_str_aset, rb_str_aset_m -
op_aset
public IRubyObject op_aset(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) -
slice_bang
rb_str_slice_bang -
slice_bang
-
succ
-
succ_bang
Deprecated. -
succ_bang
-
upto
rb_str_upto_m -
upto
public final IRubyObject upto(ThreadContext context, IRubyObject end, IRubyObject excl, Block block) -
include_p
rb_str_include -
chr
-
getbyte
-
setbyte
-
to_i
Deprecated. -
to_i
-
to_i
Deprecated. -
to_i
rb_str_to_i -
stringToInum
rb_str_to_inum -
stringToInum
-
oct
rb_str_oct -
hex
rb_str_hex -
to_f
Deprecated. -
to_f
-
split
-
split
-
splitWithBlock
rb_str_split_m -
splitWithBlock
-
split
-
splitWithBlock
public IRubyObject splitWithBlock(ThreadContext context, IRubyObject pattern, IRubyObject limit, Block block) -
split
Deprecated.Split for ext (Java) callers (does not write $~).- Parameters:
delimiter-- Returns:
- splited entries
-
split
Deprecated. -
split
Split for ext (Java) callers (does not write $~).- Parameters:
context- the thread contextdelimiter-limit-- Returns:
- splited entries
-
split
Deprecated. -
split
Deprecated. -
split
Split for ext (Java) callers (does not write $~).- Parameters:
context- the thread contextdelimiter-limit-- Returns:
- splited entries
-
singletonClass
Description copied from class:RubyBasicObjectWill either return the existing singleton class for this object, or create a new one and return that. For a few types a singleton class is not possible so it will throw an error.- Specified by:
singletonClassin interfaceIRubyObject- Overrides:
singletonClassin classRubyBasicObject- Parameters:
context- the current thread context- Returns:
- the singleton of this type
-
scan
rb_str_scan -
start_with_p
-
start_with_p
-
start_with_p
-
startsWith
-
end_with_p
-
end_with_p
-
end_with_p
-
endWith
-
endsWithAsciiChar
public boolean endsWithAsciiChar(char c) -
delete_prefix
-
delete_suffix
-
delete_prefix_bang
-
delete_suffix_bang
-
ljust
Deprecated. -
ljust
rb_str_ljust -
ljust
Deprecated. -
ljust
-
rjust
Deprecated. -
rjust
rb_str_rjust -
rjust
Deprecated. -
rjust
-
center
Deprecated. -
center
rb_str_center -
center
Deprecated. -
center
-
partition
-
partition
-
rpartition
-
append_as_bytes
-
append_as_bytes
-
append_as_bytes
-
chop
rb_str_chop / rb_str_chop_bang -
chop_bang
-
chomp19
Deprecated. -
chomp19
Deprecated. -
chomp_bang19
Deprecated. -
chomp_bang19
Deprecated. -
chomp
rb_str_chomp_bang In the common case, removes CR and LF characters in various ways depending on the value of the optional args[0]. If args.length==0 removes one instance of CR, CRLF or LF from the end of the string. If args.length>0 and args[0] is "\n" then same behaviour as args.length==0 . If args.length>0 and args[0] is "" then removes trailing multiple LF or CRLF (but no CRs at all(!)). -
chomp
-
chomp_bang
-
chomp_bang
-
lstrip
rb_str_lstrip / rb_str_lstrip_bang -
lstrip_bang
-
rstrip
rb_str_rstrip / rb_str_rstrip_bang -
rstrip_bang
-
strip
rb_str_strip / rb_str_strip_bang -
strip_bang
-
count
-
count
-
count
-
delete
rb_str_delete / rb_str_delete_bang -
delete
-
delete
-
delete_bang
-
delete_bang
-
delete_bang
-
squeeze
rb_str_squeeze / rb_str_squeeze_bang -
squeeze
-
squeeze
-
squeeze_bang
-
squeeze_bang
-
squeeze_bang
-
tr19
Deprecated. -
tr_bang19
Deprecated. -
tr
rb_str_tr / rb_str_tr_bang -
tr_bang
-
tr_s19
Deprecated. -
tr_s_bang19
@Deprecated public IRubyObject tr_s_bang19(ThreadContext context, IRubyObject src, IRubyObject repl) Deprecated. -
tr_s
rb_str_tr_s / rb_str_tr_s_bang -
tr_s_bang
-
each_line
rb_str_each_line -
each_line
-
each_line
-
each_lineCommon
Deprecated. -
lines
-
lines
-
lines
-
each_byte
rb_str_each_byte -
bytes
-
each_char
-
chars
-
each_codepoint
rb_str_each_codepoint -
codepoints
-
grapheme_clusters
-
each_grapheme_cluster
-
intern
Deprecated. -
intern
-
ord
-
sum
-
sum
-
sumCommon
-
to_c
string_to_c -
to_r
string_to_r -
unmarshalFrom
@Deprecated(since="10.0", forRemoval=true) public static RubyString unmarshalFrom(UnmarshalStream input) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
unmarshalFrom
public static RubyString unmarshalFrom(ThreadContext context, RubyInputStream in, MarshalLoader input) -
unpack
- See Also:
-
unpack
-
unpack1
-
unpack1
-
empty
public void empty() -
encoding
-
encode_bang
-
encode_bang
-
encode_bang
-
encode_bang
public IRubyObject encode_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) -
encode
-
encode
-
encode
-
encode
public IRubyObject encode(ThreadContext context, IRubyObject toEncoding, IRubyObject forcedEncoding, IRubyObject opts) -
force_encoding
-
valid_encoding_p
-
ascii_only_p
-
b
-
scrub
-
scrub
-
scrub_bang
-
scrub_bang
-
freeze
- Overrides:
freezein classRubyBasicObject
-
chill
-
chill_symbol_string
-
setValue
Deprecated. -
setValue
-
getValue
-
getBytes
public byte[] getBytes() -
getByteList
Get the ByteList which backs this Ruby String- Specified by:
getByteListin interfaceByteListHolder- Returns:
- The byte list
-
getUnicodeValue
used by ar-jdbc -
encodeBytelist
-
toJava
Description copied from interface:IRubyObjectConvert the object to the specified Java class, if possible.- Specified by:
toJavain interfaceIRubyObject- Overrides:
toJavain classRubyBasicObject- Type Parameters:
T- type- Parameters:
target- The target type to which the object should be converted.- Returns:
- java type
- See Also:
-
strScrub
Scrub the contents of this string, replacing invalid characters as appropriate. MRI: rb_str_scrub -
encStrScrub
public IRubyObject encStrScrub(ThreadContext context, org.jcodings.Encoding enc, IRubyObject repl, Block block) -
encStrScrub
public IRubyObject encStrScrub(ThreadContext context, org.jcodings.Encoding enc, IRubyObject repl, int cr, Block block) -
rbStrOffset
public int rbStrOffset(int pos) -
includeRange
public static IRubyObject includeRange(ThreadContext context, RubyString _beg, RubyString _end, IRubyObject _val, boolean exclusive) -
isBare
Deprecated. -
isBare
Is this a "bare" string, i.e. has no instance vars, and class == String. -
strDup
Deprecated. -
unpack
Deprecated. -
encode_bang
Deprecated.
-