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 class
Encoding aware String construction routines for 1.9static class
An FString is a frozen string that is also deduplicated and cached.Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
Nested 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_ALLOCATOR
Fields 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) protected
RubyString
(Ruby runtime, RubyClass rubyClass, ByteList value, int cr) protected
RubyString
(Ruby runtime, RubyClass rubyClass, ByteList value, int cr, boolean objectspace) protected
RubyString
(Ruby runtime, RubyClass rubyClass, ByteList value, org.jcodings.Encoding enc) RubyString
(Ruby runtime, RubyClass rubyClass, ByteList value, org.jcodings.Encoding encoding, boolean objectSpace) protected
RubyString
(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) void
appendIntoString
(RubyString target) ascii_only_p
(ThreadContext context) rb_to_idvoid
associateEncoding
(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 String
byteListToString
(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 String
bytesToString
(byte[] bytes) static String
bytesToString
(byte[] bytes, int beg, int len) int
capacity()
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 RubyString
cat
(byte ch) final RubyString
cat
(byte[] str) final RubyString
cat
(byte[] str, int beg, int len) final int
cat
(byte[] bytes, int p, int len, org.jcodings.Encoding enc) final RubyString
cat
(int ch) final RubyString
cat
(int code, org.jcodings.Encoding enc) final RubyString
cat
(RubyString str) final RubyString
final RubyString
final RubyString
cat19
(RubyString str2) Deprecated.final int
Deprecated.final RubyString
catAscii
(byte[] bytes, int ptr, int ptrLen) final RubyString
final RubyString
catStringUnsafe
(String str) Append a Java String to this RubyString assuming it will be the encoding of the RubyString.final RubyString
catWithCodeRange
(RubyString str2) final int
catWithCodeRange
(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) char
charAt
(int offset) chars
(ThreadContext context, Block block) static org.jcodings.Encoding
checkEncoding
(Ruby runtime, ByteList str1, ByteList str2) final org.jcodings.Encoding
checkEncoding
(RubyString other) final org.jcodings.Encoding
checkEncoding
(CodeRangeable other) void
The 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 void
codepoints
(ThreadContext context, Block block) final int
compareTo
(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 RubyClass
createStringClass
(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 RubyString
dupAsChilled
(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.void
empty()
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 ByteList
encodeBytelist
(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) boolean
endsWithAsciiChar
(char c) protected boolean
endWith
(IRubyObject tmp) void
ensureAvailable
(ThreadContext context, int extraLength) Ensure the backing store belongs to this string and has enough space to add extraLength bytes.final void
Makes sure that instance variables can be set on this object, including information about whether this object is frozen.final boolean
eql
(IRubyObject other) short circuit for String key comparisonboolean
This override does not do a "checked" dispatch.export
(ThreadContext context) force_encoding
(ThreadContext context, IRubyObject enc) freeze
(ThreadContext context) protected void
getbyte
(ThreadContext context, IRubyObject index) Get the ByteList which backs this Ruby Stringbyte[]
getBytes()
final int
getEmptyByteList
(org.jcodings.Encoding enc) org.jcodings.Encoding
Will return the Java interface that most closely can represent this object, when working through Java integration translations.org.jcodings.Encoding
This 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.int
hashCode()
This override does not do "checked" dispatch since Object usually has #hash defined.boolean
hasNul()
Does this string contain \0 anywhere (per byte search).hex
(ThreadContext context) rb_str_hexinclude_p
(ThreadContext context, IRubyObject obj) rb_str_includestatic IRubyObject
includeRange
(ThreadContext context, RubyString _beg, RubyString _end, IRubyObject _val, boolean exclusive) final boolean
index
(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 RubyString
Deprecated.inspect
(ThreadContext context) rb_str_inspectstatic RubyString
inspect
(ThreadContext context, ByteList byteList) intern()
Deprecated.intern
(ThreadContext context) final boolean
boolean
Deprecated.boolean
isBare
(ThreadContext context) Is this a "bare" string, i.e.final boolean
protected boolean
protected boolean
final boolean
final boolean
final boolean
boolean
isEmpty()
final void
int
length()
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 RubyString
final RubyString
makeIndependent
(int length) final RubyString
makeShared
(Ruby runtime, int index, int len) final RubyString
makeShared
(Ruby runtime, RubyClass meta, int index, int len) final RubyString
makeSharedString
(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 IRubyObject
minus_at
(ThreadContext context) final void
modify()
final void
modify
(int length) rb_str_modify (with length bytes ensured)final void
modify19()
Deprecated.final void
void
final void
Check that the string can be modified, raising error otherwise.void
modifyCheck
(byte[] b, int len) final void
modifyExpand
(int length) rb_str_modify_expandprotected void
static RubyString
newAllocatedString
(Ruby runtime, RubyClass metaClass) static RubyString
newBinaryString
(Ruby runtime, String str) static RubyString
newBinaryString
(Ruby runtime, ByteList str) static RubyString
newChilledString
(Ruby runtime, ByteList bytes, int coderange, String file, int line) static RubyString
newDebugChilledString
(Ruby runtime, RubyClass rubyClass, ByteList value, int cr, String file, int line) static RubyString
newDebugFrozenString
(Ruby runtime, RubyClass rubyClass, ByteList value, int cr, String file, int line) static RubyString
newEmptyBinaryString
(Ruby runtime) static RubyString
newEmptyString
(Ruby runtime) static RubyString
newEmptyString
(Ruby runtime, org.jcodings.Encoding enc) static RubyString
newEmptyString
(Ruby runtime, RubyClass metaClass) static RubyString
newEmptyString
(Ruby runtime, RubyClass metaClass, org.jcodings.Encoding enc) static RubyString
newExternalStringWithEncoding
(Ruby runtime, String string, org.jcodings.Encoding encoding) Deprecated.static RubyString
newFString
(Ruby runtime, String content) Create anew or deduplicate a RubyString based on the given Java String content.static RubyString
newInstance
(IRubyObject recv, IRubyObject[] args, Block block) rb_str_s_newstatic RubyString
newInternalFromJavaExternal
(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 RubyString
static RubyString
static RubyString
static RubyString
newString
(Ruby runtime, CharSequence str) static RubyString
newString
(Ruby runtime, CharSequence str, org.jcodings.Encoding encoding) static RubyString
static RubyString
static RubyString
newString
(Ruby runtime, RubyClass clazz, CharSequence str) Deprecated.static RubyString
static RubyString
static RubyString
Deprecated.static RubyString
newStringLight
(Ruby runtime, int size) static RubyString
newStringLight
(Ruby runtime, int size, org.jcodings.Encoding encoding) static RubyString
newStringLight
(Ruby runtime, ByteList bytes) static RubyString
newStringNoCopy
(Ruby runtime, byte[] bytes) static RubyString
newStringNoCopy
(Ruby runtime, byte[] bytes, int start, int length) static RubyString
newStringNoCopy
(Ruby runtime, byte[] bytes, int start, int length, org.jcodings.Encoding encoding) static RubyString
newStringNoCopy
(Ruby runtime, RubyClass clazz, ByteList bytes) static RubyString
newStringNoCopy
(Ruby runtime, RubyClass clazz, ByteList bytes, org.jcodings.Encoding enc, int cr) static RubyString
newStringNoCopy
(Ruby runtime, ByteList bytes) static RubyString
newStringNoCopy
(Ruby runtime, ByteList bytes, org.jcodings.Encoding enc, int cr) static RubyString
newStringShared
(Ruby runtime, byte[] bytes) Deprecated.static RubyString
newStringShared
(Ruby runtime, byte[] bytes, int start, int length) Deprecated.static RubyString
newStringShared
(Ruby runtime, byte[] bytes, int start, int length, org.jcodings.Encoding encoding) static RubyString
newStringShared
(Ruby runtime, byte[] bytes, org.jcodings.Encoding encoding) Deprecated.static RubyString
newStringShared
(Ruby runtime, RubyClass clazz, ByteList bytes) static RubyString
newStringShared
(Ruby runtime, RubyClass clazz, ByteList bytes, org.jcodings.Encoding encoding) static RubyString
newStringShared
(Ruby runtime, RubyString orig) static RubyString
newStringShared
(Ruby runtime, ByteList bytes) static RubyString
newStringShared
(Ruby runtime, ByteList bytes, int codeRange) static RubyString
newStringShared
(Ruby runtime, ByteList bytes, org.jcodings.Encoding encoding) static RubyString
newUnicodeString
(Ruby runtime, CharSequence str) static RubyString
newUnicodeString
(Ruby runtime, String str) static RubyString
newUSASCIIString
(Ruby runtime, String str) static RubyString
newUsAsciiStringNoCopy
(Ruby runtime, ByteList bytes) static RubyString
newUsAsciiStringShared
(Ruby runtime, byte[] bytes, int start, int length) static RubyString
newUsAsciiStringShared
(Ruby runtime, ByteList bytes) static RubyString
newUTF16String
(Ruby runtime, CharSequence str) static RubyString
newUTF16String
(Ruby runtime, String str) static RubyString
newUTF8String
(Ruby runtime, CharSequence str) static RubyString
newUTF8String
(Ruby runtime, String str) static RubyString
objAsString
(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 int
op_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 IRubyObject
plus_at()
Deprecated.final IRubyObject
plus_at
(ThreadContext context) final RubyString
prepend
(byte ch) final RubyString
prepend
(int ch) prepend
(ThreadContext context, IRubyObject other) rb_str_prependprepend
(ThreadContext context, IRubyObject[] objs) rb_str_prependstatic IRubyObject
rbStrEscape
(ThreadContext context, RubyString str) int
rbStrOffset
(int pos) replace
(IRubyObject other) Deprecated.replace
(ThreadContext context, IRubyObject other) rb_str_replace_mreplace19
(IRubyObject other) Deprecated.final void
resize
(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 int
static int
scanForCodeRange
(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 void
final void
setCodeRange
(int codeRange) void
setEncoding
(org.jcodings.Encoding encoding) final void
setEncodingAndCodeRange
(org.jcodings.Encoding enc, int cr) void
setReadLength
(int length) void
setValue
(CharSequence value) Deprecated.void
boolean
singletonClass
(ThreadContext context) Will either return the existing singleton class for this object, or create a new one and return that.int
size()
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) boolean
startsWith
(RubyString str) str_eql_p
(ThreadContext context, IRubyObject other) str_eql_p19
(ThreadContext context, IRubyObject other) Deprecated.final RubyString
strDup()
Deprecated.final RubyString
final RubyString
int
strHashCode
(Ruby runtime) Generate a hash for the String, using its associated Ruby instance's hash seed.static byte[]
stringToBytes
(String string) final IRubyObject
stringToInum
(int base) stringToInum
(int base, boolean badcheck) rb_str_to_inumstatic RubyString
stringValue
(IRubyObject object) strip
(ThreadContext context) rb_str_strip / rb_str_strip_bangstrip_bang
(ThreadContext context) final int
strScrub
(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 IRubyObject
subBangFast
(ThreadContext context, RubyRegexp regexp, RubyString repl) sub! but without any frame globals ...subSequence
(int start, int end) final IRubyObject
substr
(int beg, int len) Deprecated.final IRubyObject
Deprecated.final IRubyObject
substr
(ThreadContext context, int beg, int len) final IRubyObject
Deprecated.final IRubyObject
Deprecated.final IRubyObject
substrEnc
(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.Encoding
toEncoding
(Ruby runtime) Deprecated.<T> T
Convert 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 IRubyObject
try_convert
(ThreadContext context, IRubyObject recv, IRubyObject str) undump
(ThreadContext context) static RubyString
unmarshalFrom
(UnmarshalStream input) Deprecated, for removal: This API element is subject to removal in a future version.static RubyString
unmarshalFrom
(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) int
unseededStrHashCode
(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 IRubyObject
upto
(ThreadContext context, IRubyObject end, Block block) rb_str_upto_mfinal IRubyObject
upto
(ThreadContext context, IRubyObject end, IRubyObject excl, Block block) valid_encoding_p
(ThreadContext context) void
final void
Methods 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, toRubyString
Methods 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, yieldUnder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints
Methods 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:
getEncoding
in interfaceEncodingCapable
-
setEncoding
public void setEncoding(org.jcodings.Encoding encoding) - Specified by:
setEncoding
in interfaceEncodingCapable
-
shouldMarshalEncoding
public boolean shouldMarshalEncoding()- Specified by:
shouldMarshalEncoding
in interfaceMarshalEncoding
-
getMarshalEncoding
public org.jcodings.Encoding getMarshalEncoding()- Specified by:
getMarshalEncoding
in 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:
getCodeRange
in interfaceCodeRangeable
-
setCodeRange
public final void setCodeRange(int codeRange) - Specified by:
setCodeRange
in interfaceCodeRangeable
-
clearCodeRange
public final void clearCodeRange()- Specified by:
clearCodeRange
in interfaceCodeRangeable
-
keepCodeRange
public final void keepCodeRange()- Specified by:
keepCodeRange
in interfaceCodeRangeable
-
isCodeRangeAsciiOnly
public final boolean isCodeRangeAsciiOnly() -
isAsciiOnly
public final boolean isAsciiOnly() -
isCodeRangeValid
public final boolean isCodeRangeValid()- Specified by:
isCodeRangeValid
in interfaceCodeRangeable
-
isCodeRangeBroken
public final boolean isCodeRangeBroken() -
isBrokenString
public final boolean isBrokenString() -
scanForCodeRange
public final int scanForCodeRange()- Specified by:
scanForCodeRange
in interfaceCodeRangeable
-
scanForCodeRange
-
checkEncoding
-
checkEncoding
- Specified by:
checkEncoding
in interfaceCodeRangeable
-
checkEncoding
-
strLength
public final int strLength() -
eql
short circuit for String key comparison- Specified by:
eql
in interfaceIRubyObject
- Overrides:
eql
in 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:RubyObject
This 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:
getNativeClassIndex
in interfaceCoreObjectType
- Overrides:
getNativeClassIndex
in classRubyObject
- Returns:
- the ClassIndex of the native type this object was constructed from
- See Also:
-
getJavaClass
Description copied from class:RubyBasicObject
Will return the Java interface that most closely can represent this object, when working through Java integration translations.- Specified by:
getJavaClass
in interfaceIRubyObject
- Overrides:
getJavaClass
in classRubyBasicObject
- Returns:
- the true Java class of this (Ruby) object
-
convertToString
Description copied from class:RubyBasicObject
Tries to convert this object to a Ruby String using the "to_str" method.- Specified by:
convertToString
in interfaceIRubyObject
- Overrides:
convertToString
in classRubyBasicObject
- Returns:
- a string representation of this
-
toString
Description copied from class:RubyObject
The default toString method is just a wrapper that calls the Ruby "to_s" method.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in 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:
dup
in interfaceIRubyObject
- Overrides:
dup
in classRubyBasicObject
- Returns:
- A new RubyString sharing the original backing store.
-
dupFrozen
-
dup
Description copied from interface:IRubyObject
RubyMethod dup.- Specified by:
dup
in 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:RubyBasicObject
The actual method that checks frozen with the default frozen message from MRI. If possible, call this instead ofRubyBasicObject.testFrozen(java.lang.String)
.- Overrides:
checkFrozen
in classRubyBasicObject
-
ensureInstanceVariablesSettable
public final void ensureInstanceVariablesSettable()Description copied from class:RubyBasicObject
Makes 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:
ensureInstanceVariablesSettable
in classRubyBasicObject
-
mutateChilledString
protected void mutateChilledString() -
isChilled
protected boolean isChilled() -
isChilledLiteral
protected boolean isChilledLiteral() -
modify
public final void modify()- Specified by:
modify
in interfaceByteListHolder
-
modify19
Deprecated. -
modifyAndClearCodeRange
public final void modifyAndClearCodeRange() -
modifyAndKeepCodeRange
public void modifyAndKeepCodeRange()- Specified by:
modifyAndKeepCodeRange
in interfaceCodeRangeable
-
modify
public final void modify(int length) rb_str_modify (with length bytes ensured)- Specified by:
modify
in 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:RubyBasicObject
rb_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:
asString
in interfaceIRubyObject
- Overrides:
asString
in classRubyBasicObject
- Returns:
- string representation
-
checkStringType
Description copied from class:RubyBasicObject
rb_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:
checkStringType
in interfaceIRubyObject
- Overrides:
checkStringType
in classRubyBasicObject
- Returns:
- nil if type check failed
-
try_convert
-
to_s
- Overrides:
to_s
in classRubyBasicObject
-
compareTo
Description copied from class:RubyBasicObject
Compares this Ruby object with another.- Specified by:
compareTo
in interfaceComparable<IRubyObject>
- Overrides:
compareTo
in 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_cmp
in classRubyBasicObject
-
op_equal
rb_str_equal- Specified by:
op_equal
in interfaceIRubyObject
- Overrides:
op_equal
in 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:RubyBasicObject
Will 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:
hash
in classRubyBasicObject
- Parameters:
context
- the current thread context- Returns:
- the hash value
-
hashCode
public int hashCode()Description copied from class:RubyObject
This override does not do "checked" dispatch since Object usually has #hash defined.- Overrides:
hashCode
in 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:RubyObject
This override does not do a "checked" dispatch.- Overrides:
equals
in 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:
asJavaString
in interfaceIRubyObject
- Overrides:
asJavaString
in 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_copy
in classRubyBasicObject
- Parameters:
other
- object- Returns:
- a copy
-
initialize_copy
Description copied from class:RubyBasicObject
Initializes 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_copy
in 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:
initialize
in classRubyBasicObject
-
initialize
-
initialize
-
casecmp
-
casecmp_p
-
op_match
rb_str_match- Overrides:
op_match
in 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:IRubyObject
RubyMethod inspect.- Specified by:
inspect
in interfaceIRubyObject
- Overrides:
inspect
in classRubyBasicObject
- Returns:
- String
-
inspect
rb_str_inspect- Specified by:
inspect
in interfaceIRubyObject
- Overrides:
inspect
in classRubyBasicObject
-
rbStrEscape
-
inspect
Deprecated. -
inspect
-
size
public int size() -
rubyLength
-
bytesize
-
bytesize
Deprecated. -
length
public int length()- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int offset) - Specified by:
charAt
in interfaceCharSequence
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
empty_p
rb_str_empty -
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCharSequence
-
appendIntoString
- Specified by:
appendIntoString
in 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:RubyBasicObject
Will 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:
singletonClass
in interfaceIRubyObject
- Overrides:
singletonClass
in 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:
freeze
in classRubyBasicObject
-
chill
-
chill_symbol_string
-
setValue
Deprecated. -
setValue
-
getValue
-
getBytes
public byte[] getBytes() -
getByteList
Get the ByteList which backs this Ruby String- Specified by:
getByteList
in interfaceByteListHolder
- Returns:
- The byte list
-
getUnicodeValue
used by ar-jdbc -
encodeBytelist
-
toJava
Description copied from interface:IRubyObject
Convert the object to the specified Java class, if possible.- Specified by:
toJava
in interfaceIRubyObject
- Overrides:
toJava
in 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.
-