47件ヒット
[1-47件を表示]
(0.014秒)
別のキーワード
ライブラリ
- ビルトイン (47)
キーワード
- delete! (11)
-
end
_ with? (7) -
start
_ with? (7) - unpack (11)
検索結果
先頭5件
-
String
# delete(*strs) -> String (18220.0) -
self から strs に含まれる文字を取り除いた文字列を生成して返します。
...合は、
すべての引数にマッチする文字だけが削除されます。
@param strs 削除する文字列を示す文字列 (のリスト)
//emlist[例][ruby]{
p "123456789".delete("2378") #=> "14569"
p "123456789".delete("2-8", "^4-6") #=> "14569"
//}
@see String#delete!... -
String
# delete!(*strs) -> self | nil (6226.0) -
self から strs に含まれる文字を破壊的に取り除きます。
...r.delete!("2378") #=> "14569"
p str #=> "14569"
str = "123456789"
p str.delete!("2-8", "^4-6") #=> "14569"
p str #=> "14569"
str = "abc"
p str.delete!("2378") #=> "nil"
p str #=> "abc"
//}
@see String#delete... -
String
# unpack(template) -> Array (121.0) -
Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。
...トの配列
以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることができます。「長さ」の代わりに`*'とすることで「残り全て」
を表すことも...... String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。
: a
ASCII文字列(ヌル文字を詰める/後続するヌル文字やスペースを残す)
//emlist[][ruby]{
["abc"].pack("a") # => "a"
["abc"].pack("a*"......'ccxxcc') # => [82, 117, 98, 121]
//}
: Hexダンプを数値の配列に変換する例
//emlist[][ruby]{
"61 62 63 64 65 66".delete(' ').lines.pack('H*').unpack('C*')
# => [97, 98, 99, 100, 101, 102]
"61 62 63 64 65 66".split.collect {|c| c.hex}
# => [97, 98, 99, 100, 101, 102]
//}
: バイ......列
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることができます。「長さ」の代わりに`*'とすることで「残り全て」
を表す... -
String
# end _ with?(*strs) -> bool (113.0) -
self の末尾が strs のいずれかであるとき true を返します。
...@param strs パターンを表す文字列 (のリスト)
//emlist[例][ruby]{
"string".end_with?("ing") # => true
"string".end_with?("str") # => false
"string".end_with?("str", "ing") # => true
//}
@see String#start_with?
@see String#delete_suffix, String#delete_suffix!... -
String
# start _ with?(*prefixes) -> bool (113.0) -
self の先頭が prefixes のいずれかであるとき true を返します。
..."string".start_with?("str") # => true
"string".start_with?("ing") # => false
"string".start_with?("ing", "str") # => true
"string".start_with?(/\w/) # => true
"string".start_with?(/\d/) # => false
//}
@see String#end_with?
@see String#delete_prefix, String#d...