public final class RubyString extends RubyEnumerable<java.lang.String> implements java.lang.CharSequence, java.lang.Comparable<java.lang.CharSequence>, java.io.Serializable
RubyString
implements all methods refer to the String class of Ruby
language.
RubyString
is also a Java CharSequence and a Ruby.Enumerable
.
To avoid the conflict of Java 8 String#chars(), RubyString
doesn't
implement the chars() method, but instead it directly extends the
RubyEnumerable
which also implies it allows to be manipulated as
RubyEnumerable<String> and each String represents a character in this
RubyString
.
Constructor and Description |
---|
RubyString()
Returns a
RubyString with an empty String as default value. |
RubyString(java.lang.Object o)
Returns a
RubyString with calling Object.toString() on
given Object as default value. |
Modifier and Type | Method and Description |
---|---|
boolean |
asciiOnlyʔ()
Checks if
RubyString only contains ascii. |
RubyString |
b()
Returns a copied string whose encoding is ASCII-8BIT.
|
RubyArray<java.lang.Byte> |
bytes()
Returns an
RubyArray of Byte in RubyString . |
int |
bytesize()
Returns the length of
RubyString in bytes. |
RubyString |
byteslice(int index)
Returns a substring of one byte at given index.
|
RubyString |
byteslice(int offset,
int length)
Returns a substring starting at the offset given by the first, and a length
given by the second.
|
RubyString |
capitalize()
Returns a copy of
RubyString with the first character converted to
uppercase and the remainder to lowercase. |
RubyString |
capitalizeǃ()
Modifies
RubyString by converting the first character to uppercase
and the remainder to lowercase. |
int |
casecmp(java.lang.CharSequence charSeq)
Case-insensitive version of
compareTo(CharSequence) . |
RubyString |
center(int width)
Returns a new
RubyString of length width with str centered and
padded with spaces. |
RubyString |
center(int width,
java.lang.String padstr)
Returns a new
RubyString of length width with str centered and
padded with padstr. |
char |
charAt(int index) |
RubyString |
chomp()
Returns a new
RubyString with the line separator removed from the
end of str. |
RubyString |
chomp(java.lang.String separator)
Returns a new
RubyString with the given line separator removed from
the end of str. |
RubyString |
chompǃ()
Modifies str in place as described for
chomp() , returning str, or
null if no modifications were made. |
RubyString |
chompǃ(java.lang.String separator)
Modifies str in place as described for
chomp() , returning str, or
null if no modifications were made. |
RubyString |
chop()
Returns a new
RubyString with the last character removed. |
RubyString |
chopǃ()
Processes str as for
chop() , returning str, or null if str is the
empty string. |
RubyString |
chr()
Returns a one-character string at the beginning of the string.
|
RubyString |
clear()
Makes string empty.
|
RubyArray<java.lang.Integer> |
codepoints()
Returns a
RubyArray of the Integer ordinals of the characters in
str. |
int |
compareTo(java.lang.CharSequence o) |
RubyString |
concat(int codepoint)
Appends the given codepoint as a character to str.
|
RubyString |
concat(java.lang.Object o)
Appends the given object to str.
|
int |
count(java.lang.String charSet,
java.lang.String... charSets)
Each charSet parameter defines a set of characters to count.
|
RubyString |
crypt(java.lang.String salt)
Applies a one-way cryptographic hash to str by invoking the
MessageDigest(MD5) with the given salt string.
|
RubyString |
delete(java.lang.String charSet)
Returns a copy of str with all characters in the intersection of its
arguments deleted.
|
RubyString |
deleteǃ(java.lang.String charSet)
Performs a delete operation in place, returning str, or null if str was not
modified.
|
RubyString |
downcase()
Returns a copy of str with all uppercase letters replaced with their
lowercase.
|
RubyString |
downcaseǃ()
Downcases the contents of str, returning null if no changes were made.
|
RubyString |
dump()
Produces a version of str with all non-printing or non-ASCII 8bit
characters replaced by \\nnn or \\unnnn notation and all special characters
escaped.
|
RubyEnumerator<java.lang.Byte> |
eachByte()
Returns a
RubyEnumerator of each byte in str. |
RubyString |
eachByte(Block<java.lang.Byte> block)
Passes each byte in str to the given block.
|
RubyEnumerator<java.lang.String> |
eachChar()
Returns a
RubyEnumerator of each character in str. |
RubyString |
eachChar(Block<java.lang.String> block)
Passes each character in str to the given block.
|
RubyEnumerator<java.lang.Integer> |
eachCodepoint()
Returns a
RubyEnumerator of each codepoint in str. |
RubyString |
eachCodepoint(Block<java.lang.Integer> block)
Passes each codepoint in str to the given block.
|
RubyEnumerator<java.lang.String> |
eachLine()
Returns a
RubyEnumerator of each line in str. |
RubyString |
eachLine(Block<java.lang.String> block)
Passes each line in str to the given block.
|
RubyEnumerator<java.lang.String> |
eachLine(java.lang.String separator)
Returns a
RubyEnumerator of each line by given separator in str. |
RubyString |
eachLine(java.lang.String separator,
Block<java.lang.String> block)
Passes each line by given separator in str to the given block.
|
boolean |
emptyʔ()
Returns true if str has a length of zero.
|
RubyString |
encode(java.lang.String encoding)
Returns a copy of str transcoded to encoding encoding.
|
RubyString |
encode(java.lang.String dstEncoding,
java.lang.String srcEncoding)
Returns a copy of str transcoded from srcEncoding to dstEncoding.
|
RubyString |
encodeǃ(java.lang.String encoding)
Returns the str transcoded to encoding encoding.
|
RubyString |
encodeǃ(java.lang.String dstEncoding,
java.lang.String srcEncoding)
Returns the str transcoded from srcEncoding to dstEncoding.
|
java.nio.charset.Charset |
encoding()
Returns UTF-8 Charset.
|
boolean |
endWithʔ(java.lang.String suffix,
java.lang.String... otherSuffix)
Returns true if str ends with one of the suffixes given.
|
boolean |
eqlʔ(java.lang.Object o)
Two RubyString are equal if they have the same length and content.
|
boolean |
equals(java.lang.Object o) |
RubyString |
forceEncoding(java.lang.String encoding)
Changes the encoding to encoding and returns self.
|
java.lang.Byte |
getbyte(int index)
Returns the indexth byte, or null if index was out of range.
|
protected java.lang.Iterable<java.lang.String> |
getIterable()
Returns an Iterable of elements.
|
RubyEnumerator<java.lang.String> |
gsub(java.lang.String regex)
Returns a
RubyEnumerator of all matched str. |
RubyString |
gsub(java.lang.String regex,
java.util.Map<java.lang.String,?> map)
Returns a copy of str with the all occurrences of pattern substituted for
the second argument.
|
RubyString |
gsub(java.lang.String regex,
java.lang.String replacement)
Returns a copy of str with the all occurrences of pattern substituted for
the second argument.
|
RubyString |
gsub(java.lang.String regex,
TransformBlock<java.lang.String,java.lang.String> block)
Returns a copy of str with the all occurrences of pattern substituted for
the second argument.
|
RubyEnumerator<java.lang.String> |
gsubǃ(java.lang.String regex)
Returns a
RubyEnumerator of all matched str. |
RubyString |
gsubǃ(java.lang.String regex,
java.lang.String replacement)
Performs the substitutions of
gsub(String, String) in place,
returning this RubyString , or null if no substitutions were
performed. |
RubyString |
gsubǃ(java.lang.String regex,
TransformBlock<java.lang.String,java.lang.String> block)
Performs the substitutions of
gsub(String, TransformBlock) in
place, returning this RubyString , or null if no substitutions were
performed. |
int |
hash()
Return a hash based on the string’s length and content.
|
int |
hashCode() |
long |
hex()
Treats leading characters from str as a string of hexadecimal digits (with
an optional sign and an optional 0x) and returns the corresponding number.
|
boolean |
includeʔ(java.lang.String otherStr)
Returns true if str contains the given string.
|
java.lang.Integer |
index(java.util.regex.Pattern regex)
Returns the index of the first occurrence of the given Pattern in str.
|
java.lang.Integer |
index(java.util.regex.Pattern regex,
int offset)
Returns the index of the first occurrence of the given Pattern in str by an
offset.
|
java.lang.Integer |
index(java.lang.String substring)
Returns the index of the first occurrence of the given substring in str.
|
java.lang.Integer |
index(java.lang.String substring,
int offset)
Returns the index of the first occurrence of the given substring in str.
|
RubyString |
insert(int index,
java.lang.String otherStr)
Inserts otherStr before the character at the given index, modifying str.
|
RubyString |
inspect()
Returns a printable version of str, surrounded by quote marks, with special
characters escaped.
|
int |
length() |
RubyArray<java.lang.String> |
lines()
Returns a
RubyArray of lines in str split using the supplied record
separator (System.getProperty("line.separator") by default). |
RubyArray<java.lang.String> |
lines(java.lang.String separator)
Returns a
RubyArray of lines in str split using given record
separator. |
RubyString |
ljust(int width)
If integer is greater than the length of str, returns a new
RubyString of length integer with str left justified and padded
with whitesapce; otherwise, returns str. |
RubyString |
ljust(int width,
java.lang.String padstr)
If integer is greater than the length of str, returns a new
RubyString of length integer with str left justified and padded
with padstr; otherwise, returns str. |
RubyString |
lstrip()
Returns a copy of str with leading whitespace removed.
|
RubyString |
lstripǃ()
Removes leading whitespace from str, returning null if no change was made.
|
java.util.regex.Matcher |
match(java.lang.String regex)
Converts regex to a Pattern, then invokes its match method on str.
|
java.util.regex.Matcher |
match(java.lang.String regex,
int pos)
Converts regex to a Pattern, then invokes its match method on str.
|
RubyString |
next()
Returns the successor to str.
|
RubyString |
nextǃ()
Equivalent to
next() , but modifies the receiver in place. |
int |
oct()
Treats leading characters of str as a string of octal digits (with an
optional sign) and returns the corresponding number.
|
int |
ord()
Return the Integer ordinal of a one-character string.
|
RubyArray<java.lang.String> |
partition(java.util.regex.Pattern pattern)
Searches pattern in the string and returns the part before it, the match,
and the part after it.
|
RubyArray<java.lang.String> |
partition(java.lang.String sep)
Searches sep in the string and returns the part before it, the match, and
the part after it.
|
RubyString |
prepend(java.lang.String otherStr)
Prepends the given string to str.
|
RubyString |
replace(java.lang.String otherStr)
Replaces the contents and taintedness of str with the corresponding values
in otherStr.
|
RubyString |
reverse()
Returns a new string with the characters from str in reverse order.
|
RubyString |
reverseǃ()
Reverses str in place.
|
java.lang.Integer |
rindex(java.util.regex.Pattern pattern)
Returns the index of the last occurrence of the given Pattern in str.
|
java.lang.Integer |
rindex(java.util.regex.Pattern pattern,
int stopAt)
Returns the index of the last occurrence of the given Pattern in str.
|
java.lang.Integer |
rindex(java.lang.String substring)
Returns the index of the last occurrence of the given substring in str.
|
java.lang.Integer |
rindex(java.lang.String substring,
int stopAt)
Returns the index of the last occurrence of the given Pattern in str.
|
RubyString |
rjust(int width)
If width is greater than the length of str, returns a new String of length
integer with str right justified and padded with whitespace; otherwise,
returns str.
|
RubyString |
rjust(int width,
java.lang.String padstr)
If width is greater than the length of str, returns a new String of length
integer with str right justified and padded with padstr; otherwise, returns
str.
|
RubyArray<java.lang.String> |
rpartition(java.util.regex.Pattern pattern)
Searches Pattern in the string from the end of the string, and returns the
part before it, the match, and the part after it.
|
RubyArray<java.lang.String> |
rpartition(java.lang.String sep)
Searches sep in the string from the end of the string, and returns the part
before it, the match, and the part after it.
|
RubyString |
rstrip()
Returns a copy of str with trailing whitespace removed.
|
RubyString |
rstripǃ()
Removes trailing whitespace from str, returning nil if no change was made.
|
RubyArray<java.lang.String> |
scan(java.lang.String regex)
Both forms iterate through str, matching the regexp.
|
RubyString |
scan(java.lang.String regex,
Block<java.lang.String> block)
Both forms iterate through str, matching the regexp.
|
RubyArray<RubyArray<java.lang.String>> |
scanGroups(java.lang.String regex)
Both forms iterate through str, matching the regexp.
|
RubyString |
scanGroups(java.lang.String regex,
Block<RubyArray<java.lang.String>> block)
Both forms iterate through str, matching the regexp.
|
RubyString |
scrub()
If the string is invalid byte sequence then replace invalid bytes with �.
|
RubyString |
scrub(java.lang.String repl)
If the string is invalid byte sequence then replace invalid bytes with
given replacement character.
|
RubyString |
scrub(TransformBlock<RubyArray<java.lang.Byte>,java.lang.String> block)
If the string is invalid byte sequence then replace invalid bytes with
returned value of the block.
|
RubyString |
scrubǃ()
If the string is invalid byte sequence then replace invalid bytes with �.
|
RubyString |
scrubǃ(java.lang.String repl)
If the string is invalid byte sequence then replace invalid bytes with
given replacement character.
|
RubyString |
scrubǃ(TransformBlock<RubyArray<java.lang.Byte>,java.lang.String> block)
If the string is invalid byte sequence then replace invalid bytes with
returned value of the block.
|
byte |
setbyte(int index,
byte b)
Modifies the indexth byte.
|
int |
size()
Returns the character length of str.
|
RubyString |
slice(int index)
Returns a substring of one character at that index.
|
RubyString |
slice(int index,
int length)
Returns a substring containing length characters starting at the index.
|
RubyString |
slice(java.util.regex.Pattern pattern)
Returns the matching portion of the string.
|
RubyString |
slice(java.util.regex.Pattern pattern,
int group)
Returns the target group of matching portion of the string.
|
RubyString |
slice(java.lang.String matchStr)
Returns if matchStr occurs in the string.
|
RubyString |
sliceǃ(int index)
Deletes the specified portion from str, and returns the portion deleted.
|
RubyString |
sliceǃ(int index,
int length)
Deletes the specified portion from str, and returns the portion deleted.
|
RubyString |
sliceǃ(java.util.regex.Pattern pattern)
Deletes the specified portion from str, and returns the portion deleted.
|
RubyString |
sliceǃ(java.util.regex.Pattern pattern,
int group)
Deletes the specified portion from str, and returns the portion deleted.
|
RubyString |
sliceǃ(java.lang.String matchStr)
Deletes the specified portion from str, and returns the portion deleted.
|
RubyArray<java.lang.String> |
split()
Divides str into substrings based on a whitespaces, returning a
RubyArray of these substrings. |
RubyArray<java.lang.String> |
split(java.util.regex.Pattern pattern)
Divides str into substrings based on a Pattern, returning a
RubyArray of these substrings. |
RubyArray<java.lang.String> |
split(java.util.regex.Pattern pattern,
int limit)
Divides str into substrings based on a Pattern, returning a
RubyArray of these substrings, at most that limit number of fields
will be returned. |
RubyArray<java.lang.String> |
split(java.lang.String delimiter)
Divides str into substrings based on a delimiter, returning a
RubyArray of these substrings. |
RubyArray<java.lang.String> |
split(java.lang.String delimiter,
int limit)
Divides str into substrings based on a delimiter, returning a
RubyArray of these substrings, at most that limit number of fields
will be returned. |
RubyString |
squeeze()
Builds a set of characters using the procedure described for
RubyEnumerable.count() . |
RubyString |
squeeze(java.lang.String charSet)
Builds a set of characters from the charSet using the procedure described
for
RubyEnumerable.count() . |
RubyString |
squeezeǃ()
Squeezes str in place, returning either str, or nil if no changes were
made.
|
RubyString |
squeezeǃ(java.lang.String charSet)
Squeezes str in place, returning either str, or nil if no changes were
made.
|
boolean |
startWithʔ(java.lang.String prefix,
java.lang.String... otherPrefix)
Returns true if str starts with one of the prefixes given.
|
RubyString |
strip()
Returns a copy of str with leading and trailing whitespace removed.
|
RubyString |
stripǃ()
Removes leading and trailing whitespace from str.
|
RubyString |
sub(java.lang.String regex,
java.util.Map<java.lang.String,?> map)
Returns a copy of str with the first occurrence of pattern replaced by the
second argument.
|
RubyString |
sub(java.lang.String regex,
java.lang.String replacement)
Returns a copy of str with the first occurrence of pattern replaced by the
second argument.
|
RubyString |
sub(java.lang.String regex,
TransformBlock<java.lang.String,java.lang.String> block)
Returns a copy of str with the first occurrence of pattern replaced by the
value returned by the block will be substituted for the match on each call.
|
java.lang.CharSequence |
subSequence(int start,
int end) |
RubyString |
subǃ(java.lang.String regex,
java.lang.String replacement)
Performs the same substitution as
sub(String, String) in-place. |
RubyString |
subǃ(java.lang.String regex,
TransformBlock<java.lang.String,java.lang.String> block)
Performs the same substitution as
sub(String, TransformBlock)
in-place. |
RubyString |
succ()
Returns the successor to str.
|
RubyString |
succǃ()
Equivalent to
succ() , but modifies the receiver in place. |
int |
sum()
Returns a basic n-bit checksum of the characters in str, where n is 16.
|
int |
sum(int n)
Returns a basic n-bit checksum of the characters in str, where n is the
optional Fixnum parameter.
|
RubyString |
swapcase()
Returns a copy of str with uppercase alphabetic characters converted to
lowercase and lowercase characters converted to uppercase.
|
RubyString |
swapcaseǃ()
Equivalent to
swapcase() , but modifies the receiver in place,
returning str, or null if no changes were made. |
double |
toF()
Returns the result of interpreting leading characters in str as a floating
point number.
|
int |
toI()
Returns the result of interpreting leading characters in str as a integer
number.
|
int |
toI(int radix)
Returns the result of interpreting leading characters in str as a integer
number.
|
java.lang.String |
toS()
Returns the receiver.
|
java.lang.String |
toStr()
Returns the receiver.
|
java.lang.String |
toString() |
RubyString |
tr(java.lang.String fromStr,
java.lang.String toStr)
Returns a copy of str with the characters in fromStr replaced by the
corresponding characters in toStr.
|
RubyString |
trS(java.lang.String fromStr,
java.lang.String toStr)
Processes a copy of str as described under
tr(String, String) ,
then removes duplicate characters in regions that were affected by the
translation. |
RubyString |
trSǃ(java.lang.String fromStr,
java.lang.String toStr)
Performs
trS(String, String) processing on str in place, returning
str, or null if no changes were made. |
RubyString |
trǃ(java.lang.String fromStr,
java.lang.String toStr)
Translates str in place, using the same rules as
tr(String, String) . |
RubyArray<java.lang.Object> |
unpack(java.lang.String format)
Decodes str (which may contain binary data) according to the format string,
returning an array of each value extracted.
|
RubyString |
upcase()
Returns a copy of str with all lowercase letters replaced with their
uppercase counterparts.
|
RubyString |
upcaseǃ()
Upcases the contents of str, returning nil if no changes were made.
|
RubyEnumerator<java.lang.String> |
upto(java.lang.String otherStr)
Iterates through successive values, starting at str and ending at otherStr
inclusive, passing each value in turn to the block.
|
RubyString |
upto(java.lang.String otherStr,
Block<java.lang.String> block)
Iterates through successive values, starting at str and ending at otherStr
inclusive, passing each value in turn to the block.
|
RubyEnumerator<java.lang.String> |
upto(java.lang.String otherStr,
boolean exclusive)
Iterates through successive values, starting at str and ending at otherStr
inclusive, passing each value in turn to the block.
|
RubyString |
upto(java.lang.String otherStr,
boolean exclusive,
Block<java.lang.String> block)
Iterates through successive values, starting at str and ending at otherStr,
passing each value in turn to the block.
|
boolean |
validEncodingʔ(java.lang.String encoding)
Returns true for a string which encoded correctly.
|
allʔ, allʔ, anyʔ, anyʔ, chunk, chunk, collect, collect, collect, collectConcat, collectConcat, count, count, cycle, cycle, cycle, cycle, detect, detect, drop, dropWhile, dropWhile, each, each, eachCons, eachCons, eachEntry, eachEntry, eachSlice, eachSlice, eachWithIndex, eachWithIndex, eachWithObject, eachWithObject, entries, find, find, findAll, findAll, findIndex, findIndex, findIndex, first, first, flatMap, flatMap, grep, grep, grep, groupBy, groupBy, groupBy, inject, inject, inject, inject, iterator, lazy, map, map, map, max, max, maxBy, maxBy, maxBy, maxBy, memberʔ, min, min, minBy, minBy, minBy, minBy, minmax, minmax, minmaxBy, minmaxBy, minmaxBy, minmaxBy, noneʔ, noneʔ, oneʔ, oneʔ, partition, partition, reduce, reduce, reduce, reduce, reject, reject, reverseEach, reverseEach, select, select, sliceBefore, sliceBefore, sort, sortBy, sortBy, sortBy, sortBy, sortBy, take, takeWhile, takeWhile, toA, zip, zip, zip
public RubyString()
RubyString
with an empty String as default value.public RubyString(java.lang.Object o)
RubyString
with calling Object.toString()
on
given Object as default value.o
- any Objectjavax.xml.bind.TypeConstraintException
- if o is nullprotected java.lang.Iterable<java.lang.String> getIterable()
RubyEnumerable
getIterable
in class RubyEnumerable<java.lang.String>
public boolean asciiOnlyʔ()
RubyString
only contains ascii.RubyString
only contains ascii, false
otherwisepublic RubyString b()
RubyString
public RubyArray<java.lang.Byte> bytes()
RubyArray
of Byte in RubyString
.RubyArray
of Bytepublic int bytesize()
RubyString
in bytes.public RubyString byteslice(int index)
index
- of target byteRubyString
of sliced bytepublic RubyString byteslice(int offset, int length)
offset
- begin indexlength
- of the bytesRubyString
public RubyString capitalize()
RubyString
with the first character converted to
uppercase and the remainder to lowercase.RubyString
public RubyString capitalizeǃ()
RubyString
by converting the first character to uppercase
and the remainder to lowercase.RubyString
if capitalized, null otherwisepublic int casecmp(java.lang.CharSequence charSeq)
compareTo(CharSequence)
.charSeq
- any CharSequencepublic RubyString center(int width)
RubyString
of length width with str centered and
padded with spaces.width
- of resultRubyString
public RubyString center(int width, java.lang.String padstr)
RubyString
of length width with str centered and
padded with padstr.width
- of resultpadstr
- used to pad in front and after the strRubyString
public RubyString chomp()
RubyString
with the line separator removed from the
end of str.RubyString
public RubyString chompǃ()
chomp()
, returning str, or
null if no modifications were made.RubyString
or nullpublic RubyString chomp(java.lang.String separator)
RubyString
with the given line separator removed from
the end of str.separator
- a line separatorRubyString
public RubyString chompǃ(java.lang.String separator)
chomp()
, returning str, or
null if no modifications were made.RubyString
or nullpublic RubyString chop()
RubyString
with the last character removed. If the
string ends with \r\n, both characters are removed.RubyString
public RubyString chopǃ()
chop()
, returning str, or null if str is the
empty string.RubyString
or nullpublic RubyString chr()
RubyString
public RubyString clear()
RubyString
public RubyArray<java.lang.Integer> codepoints()
RubyArray
of the Integer ordinals of the characters in
str.RubyArray
public RubyString concat(int codepoint)
codepoint
- of a characterRubyString
public RubyString concat(java.lang.Object o)
o
- any ObjectRubyString
public int count(java.lang.String charSet, java.lang.String... charSets)
charSet
- a set of characterscharSets
- sets of characterspublic RubyString crypt(java.lang.String salt)
salt
- a secret stringRubyString
public RubyString delete(java.lang.String charSet)
RubyEnumerable.count()
.charSet
- a set of charactersRubyString
public RubyString deleteǃ(java.lang.String charSet)
charSet
- a set of charactersRubyString
or nullpublic RubyString downcase()
RubyString
public RubyString downcaseǃ()
RubyString
or nullpublic RubyString dump()
RubyString
public RubyEnumerator<java.lang.Byte> eachByte()
RubyEnumerator
of each byte in str.RubyEnumerator
public RubyString eachByte(Block<java.lang.Byte> block)
block
- to yield byteRubyString
public RubyEnumerator<java.lang.String> eachChar()
RubyEnumerator
of each character in str.RubyEnumerator
public RubyString eachChar(Block<java.lang.String> block)
block
- to yield characterRubyString
public RubyEnumerator<java.lang.Integer> eachCodepoint()
RubyEnumerator
of each codepoint in str.RubyEnumerator
public RubyString eachCodepoint(Block<java.lang.Integer> block)
block
- to yield characterRubyString
public RubyEnumerator<java.lang.String> eachLine()
RubyEnumerator
of each line in str.RubyEnumerator
public RubyString eachLine(Block<java.lang.String> block)
block
- to yield lineRubyString
public RubyEnumerator<java.lang.String> eachLine(java.lang.String separator)
RubyEnumerator
of each line by given separator in str.RubyEnumerator
public RubyString eachLine(java.lang.String separator, Block<java.lang.String> block)
block
- to yield lineRubyString
public boolean emptyʔ()
public RubyString encode(java.lang.String encoding)
encoding
- name of encodingRubyString
public RubyString encode(java.lang.String dstEncoding, java.lang.String srcEncoding)
dstEncoding
- name of destination encodingsrcEncoding
- name of source encodingRubyString
public RubyString encodeǃ(java.lang.String encoding)
encoding
- name of encodingRubyString
public RubyString encodeǃ(java.lang.String dstEncoding, java.lang.String srcEncoding)
dstEncoding
- name of destination encodingsrcEncoding
- name of source encodingRubyString
public java.nio.charset.Charset encoding()
public boolean endWithʔ(java.lang.String suffix, java.lang.String... otherSuffix)
suffix
- otherSuffix
- public boolean eqlʔ(java.lang.Object o)
o
- any Objectpublic RubyString forceEncoding(java.lang.String encoding)
encoding
- name of encodingRubyString
public java.lang.Byte getbyte(int index)
index
- of a bytepublic RubyString gsub(java.lang.String regex, java.lang.String replacement)
regex
- regular expressionreplacement
- any StringRubyString
public RubyString gsub(java.lang.String regex, java.util.Map<java.lang.String,?> map)
regex
- regular expressionmap
- any MapRubyString
public RubyString gsub(java.lang.String regex, TransformBlock<java.lang.String,java.lang.String> block)
regex
- regular expressionblock
- to do the replacementRubyString
public RubyEnumerator<java.lang.String> gsub(java.lang.String regex)
RubyEnumerator
of all matched str.regex
- regular expressionRubyEnumerator
public RubyString gsubǃ(java.lang.String regex, java.lang.String replacement)
gsub(String, String)
in place,
returning this RubyString
, or null if no substitutions were
performed.regex
- regular expressionreplacement
- any StringRubyString
or nullpublic RubyString gsubǃ(java.lang.String regex, TransformBlock<java.lang.String,java.lang.String> block)
gsub(String, TransformBlock)
in
place, returning this RubyString
, or null if no substitutions were
performed.regex
- regular expressionblock
- to do the replacementRubyString
or nullpublic RubyEnumerator<java.lang.String> gsubǃ(java.lang.String regex)
RubyEnumerator
of all matched str.regex
- regular expressionRubyEnumerator
public int hash()
public long hex()
public boolean includeʔ(java.lang.String otherStr)
includeʔ
in interface RubyContract.Enumerable<java.lang.String,Ruby.Enumerator<?>,RubyArray<?>>
includeʔ
in class RubyEnumerable<java.lang.String>
otherStr
- to be searchedpublic java.lang.Integer index(java.lang.String substring)
substring
- any Stringpublic java.lang.Integer index(java.lang.String substring, int offset)
substring
- any Stringoffset
- position to begin the searchpublic java.lang.Integer index(java.util.regex.Pattern regex)
regex
- a Patternpublic java.lang.Integer index(java.util.regex.Pattern regex, int offset)
regex
- a Patternoffset
- place to startpublic RubyString insert(int index, java.lang.String otherStr)
index
- position to begin insertionotherStr
- any StringRubyString
public RubyString inspect()
RubyString
public RubyArray<java.lang.String> lines()
RubyArray
of lines in str split using the supplied record
separator (System.getProperty("line.separator") by default).RubyArray
public RubyArray<java.lang.String> lines(java.lang.String separator)
RubyArray
of lines in str split using given record
separator.RubyArray
public RubyString ljust(int width)
RubyString
of length integer with str left justified and padded
with whitesapce; otherwise, returns str.width
- of new RubyString
RubyString
public RubyString ljust(int width, java.lang.String padstr)
RubyString
of length integer with str left justified and padded
with padstr; otherwise, returns str.width
- of new RubyString
padstr
- used to pad on the right of new RubyString
RubyString
public RubyString lstrip()
RubyString
public RubyString lstripǃ()
RubyString
or nullpublic java.util.regex.Matcher match(java.lang.String regex)
regex
- regular expressionpublic java.util.regex.Matcher match(java.lang.String regex, int pos)
regex
- regular expressionpos
- position begin to searchpublic RubyString next()
RubyString
public RubyString nextǃ()
next()
, but modifies the receiver in place.RubyString
public int oct()
public int ord()
public RubyArray<java.lang.String> partition(java.lang.String sep)
sep
- RubyArray
public RubyArray<java.lang.String> partition(java.util.regex.Pattern pattern)
pattern
- a PatternRubyArray
public RubyString prepend(java.lang.String otherStr)
otherStr
- any StringRubyString
public RubyString replace(java.lang.String otherStr)
otherStr
- RubyString
public RubyString reverse()
RubyString
public RubyString reverseǃ()
RubyString
public java.lang.Integer rindex(java.lang.String substring)
substring
- any Stringpublic java.lang.Integer rindex(java.lang.String substring, int stopAt)
substring
- any StringstopAt
- position to stop searchpublic java.lang.Integer rindex(java.util.regex.Pattern pattern)
pattern
- a Patternpublic java.lang.Integer rindex(java.util.regex.Pattern pattern, int stopAt)
pattern
- a PatternstopAt
- position to stop searchpublic RubyString rjust(int width)
width
- of new RubyString
RubyString
public RubyString rjust(int width, java.lang.String padstr)
width
- of new RubyString
padstr
- used to pad on the left of new RubyStringRubyString
public RubyArray<java.lang.String> rpartition(java.lang.String sep)
sep
- separatorRubyArray
public RubyArray<java.lang.String> rpartition(java.util.regex.Pattern pattern)
pattern
- a PatternRubyArray
public RubyString rstrip()
RubyString
lstrip()
,
strip()
public RubyString rstripǃ()
RubyString
lstripǃ()
,
stripǃ()
public RubyArray<java.lang.String> scan(java.lang.String regex)
RubyArray
.regex
- regular expressionRubyArray
public RubyString scan(java.lang.String regex, Block<java.lang.String> block)
regex
- regular expressionblock
- to do the replacementRubyString
public RubyArray<RubyArray<java.lang.String>> scanGroups(java.lang.String regex)
regex
- regular expressionRubyArray
public RubyString scanGroups(java.lang.String regex, Block<RubyArray<java.lang.String>> block)
regex
- regular expressionblock
- to yield matched groupsRubyString
public RubyString scrub()
RubyString
public RubyString scrub(java.lang.String repl)
RubyString
public RubyString scrub(TransformBlock<RubyArray<java.lang.Byte>,java.lang.String> block)
RubyString
public RubyString scrubǃ()
RubyString
public RubyString scrubǃ(java.lang.String repl)
RubyString
public RubyString scrubǃ(TransformBlock<RubyArray<java.lang.Byte>,java.lang.String> block)
RubyString
public byte setbyte(int index, byte b)
index
- position to modifyb
- a bytepublic int size()
public RubyString slice(int index)
index
- of the characterRubyString
or nullpublic RubyString slice(int index, int length)
index
- position to begin slicelength
- of new RubyStringRubyString
or nullpublic RubyString slice(java.util.regex.Pattern pattern)
pattern
- a PatternRubyString
or nullpublic RubyString slice(java.util.regex.Pattern pattern, int group)
pattern
- a Patterngroup
- number pf matched groupRubyString
or nullpublic RubyString slice(java.lang.String matchStr)
matchStr
- matched stringRubyString
or nullpublic RubyString sliceǃ(int index)
index
- of the characterRubyString
or nullpublic RubyString sliceǃ(int index, int length)
index
- position to begin slicelength
- of new RubyString
RubyString
or nullpublic RubyString sliceǃ(java.util.regex.Pattern pattern)
pattern
- a PatternRubyString
or nullpublic RubyString sliceǃ(java.util.regex.Pattern pattern, int group)
pattern
- a Patterngroup
- number pf matched groupRubyString
or nullpublic RubyString sliceǃ(java.lang.String matchStr)
matchStr
- matched stringRubyString
or nullpublic RubyArray<java.lang.String> split()
RubyArray
of these substrings.RubyArray
public RubyArray<java.lang.String> split(java.lang.String delimiter)
RubyArray
of these substrings.delimiter
- used to split strRubyArray
public RubyArray<java.lang.String> split(java.lang.String delimiter, int limit)
RubyArray
of these substrings, at most that limit number of fields
will be returned.delimiter
- used to split strlimit
- max number of fieldsRubyArray
public RubyArray<java.lang.String> split(java.util.regex.Pattern pattern)
RubyArray
of these substrings.pattern
- a PatternRubyArray
public RubyArray<java.lang.String> split(java.util.regex.Pattern pattern, int limit)
RubyArray
of these substrings, at most that limit number of fields
will be returned.pattern
- a Patternlimit
- max number of fieldsRubyArray
public RubyString squeeze()
RubyEnumerable.count()
.RubyString
public RubyString squeeze(java.lang.String charSet)
RubyEnumerable.count()
.charSet
- a set of charactersRubyString
public RubyString squeezeǃ()
RubyString
or nullpublic RubyString squeezeǃ(java.lang.String charSet)
charSet
- a set of charactersRubyString
or nullpublic boolean startWithʔ(java.lang.String prefix, java.lang.String... otherPrefix)
prefix
- first prefixotherPrefix
- otner prefixespublic RubyString strip()
RubyString
public RubyString stripǃ()
RubyString
public RubyString sub(java.lang.String regex, java.lang.String replacement)
regex
- regular expressionreplacement
- used to replace matched stringRubyString
public RubyString sub(java.lang.String regex, java.util.Map<java.lang.String,?> map)
regex
- regular expressionmap
- any MapRubyString
public RubyString sub(java.lang.String regex, TransformBlock<java.lang.String,java.lang.String> block)
regex
- regular expressionblock
- to do the replacementRubyString
public RubyString subǃ(java.lang.String regex, java.lang.String replacement)
sub(String, String)
in-place.
Returns str if a substitution was performed or nil if no substitution was
performed.regex
- regular expressionreplacement
- used to replace matched stringRubyString
or nullpublic RubyString subǃ(java.lang.String regex, TransformBlock<java.lang.String,java.lang.String> block)
sub(String, TransformBlock)
in-place. Returns str if a substitution was performed or nil if no
substitution was performed.regex
- regular expressionblock
- to do the replacementRubyString
or nullpublic RubyString succ()
RubyString
public RubyString succǃ()
succ()
, but modifies the receiver in place.RubyString
public int sum()
public int sum(int n)
n
- any intpublic RubyString swapcase()
RubyString
public RubyString swapcaseǃ()
swapcase()
, but modifies the receiver in place,
returning str, or null if no changes were made. Note: case conversion is
effective only in ASCII region.RubyString
or nullpublic double toF()
public int toI()
public int toI(int radix)
radix
- the number of unique digitspublic java.lang.String toS()
public java.lang.String toStr()
public RubyString tr(java.lang.String fromStr, java.lang.String toStr)
fromStr
- a list of characterstoStr
- a list of charactersRubyString
public RubyString trǃ(java.lang.String fromStr, java.lang.String toStr)
tr(String, String)
. Returns str, or nil if no changes were made.fromStr
- a list of characterstoStr
- a list of charactersRubyString
or nullpublic RubyString trS(java.lang.String fromStr, java.lang.String toStr)
tr(String, String)
,
then removes duplicate characters in regions that were affected by the
translation.fromStr
- a list of characterstoStr
- a list of charactersRubyString
public RubyString trSǃ(java.lang.String fromStr, java.lang.String toStr)
trS(String, String)
processing on str in place, returning
str, or null if no changes were made.fromStr
- a list of characterstoStr
- a list of charactersRubyString
or nullpublic RubyArray<java.lang.Object> unpack(java.lang.String format)
format
- format stringRubyArray
RubyArray.pack(String)
public RubyString upcase()
RubyString
public RubyString upcaseǃ()
RubyString
public RubyEnumerator<java.lang.String> upto(java.lang.String otherStr)
succ()
method is used to generate each value.otherStr
- any StringRubyEnumerator
public RubyEnumerator<java.lang.String> upto(java.lang.String otherStr, boolean exclusive)
succ()
method is used to generate each value. The second argument exclusive is
omitted or is false, the last value will be included; otherwise it will be
excluded.otherStr
- any Stringexclusive
- true if the last value is ommitted, false otherwiseRubyEnumerator
public RubyString upto(java.lang.String otherStr, Block<java.lang.String> block)
otherStr
- any Stringblock
- to yield successive valueRubyString
public RubyString upto(java.lang.String otherStr, boolean exclusive, Block<java.lang.String> block)
otherStr
- any Stringexclusive
- true if the last value is ommitted, false otherwiseblock
- to yield successive valueRubyString
public boolean validEncodingʔ(java.lang.String encoding)
encoding
- name of encodingpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class RubyEnumerable<java.lang.String>
public int length()
length
in interface java.lang.CharSequence
public char charAt(int index)
charAt
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public int compareTo(java.lang.CharSequence o)
compareTo
in interface java.lang.Comparable<java.lang.CharSequence>