るりまサーチ (Ruby 2.1.0)

最速Rubyリファレンスマニュアル検索!
17件ヒット [1-17件を表示] (0.057秒)
トップページ > バージョン:2.1.0[x] > クエリ:String[x] > クエリ:h[x] > クエリ:escape[x]

別のキーワード

  1. string []=
  2. string slice
  3. string slice!
  4. string []
  5. string gsub

検索結果

String#shellescape -> String (99958.0)

文字列を Bourne シェルのコマンドライン中で安全に使えるようにエスケープします。

文字列を Bourne シェルのコマンドライン中で安全に使えるようにエスケープします。

string.shellescape は、Shellwords.escape(string) と等価です。

@return エスケープされた文字列を返します。
@see Shellwords.#shellescape

WEBrick::HTMLUtils.#escape(string) -> String (63946.0)

指定された文字列に含まれる ", &, <, > を文字実体参照に変換した文字列を 生成して返します。

指定された文字列に含まれる ", &, <, > を文字実体参照に変換した文字列を
生成して返します。

@param string エスケープしたい文字列を指定します。

require 'webrick'
p WEBrick::HTMLUtils.escape('/?q=foo&hl=<ja>') #=> "/?q=foo&amp;hl=&lt;ja&gt;"

Gem::RemoteFetcher#escape(str) -> String (63625.0)

URI 文字列をエンコードした文字列を返します。

URI 文字列をエンコードした文字列を返します。

@param str 文字列を指定します。

@see URI.escape

WEBrick::HTTPUtils.#escape(str) -> String (63625.0)

与えられた文字列を数値参照文字列に変換します。

与えられた文字列を数値参照文字列に変換します。

以下の正規表現を使用して変換します。

control = (0x0..0x1f).collect{|c| c.chr }.join + "\x7f"
space = " "
delims = '<>#%"'
unwise = '{}|\\^[]`'
nonascii = (0x80..0xff).collect{|c| c.chr }.join
/[#{Regexp.escape(control + space + delims + unwise + nonascii)}]/n

@param str...

Shellwords.escape(str) -> String (63607.0)

文字列を Bourne シェルのコマンドライン中で安全に使えるようにエスケープします。

文字列を Bourne シェルのコマンドライン中で安全に使えるようにエスケープします。

このメソッドは、Shellwords.#shellescape の別名です。

@param str エスケープの対象となる文字列を指定します。
@return エスケープされた文字列を返します。

絞り込み条件を変える

ERB::Util.#h(s) -> String (54631.0)

文字列 s を HTML用にエスケープした文字列を返します。

文字列 s を HTML用にエスケープした文字列を返します。

文字列 s 中に含まれる &"<> を、実体参照 &amp; &quot; &lt; &gt; にそれぞれ変更した文字列を返します
(CGI.escapeHTMLとほぼ同じです)。

@param s HTMLエスケープを行う文字列

//emlist[例][ruby]{
require "erb"
include ERB::Util

puts html_escape("is a > 0 & a < 10?")
# is a &gt; 0 &amp; a &lt; 10?
//}

Shellwords.#shellescape(str) -> String (45904.0)

文字列を Bourne シェルのコマンドライン中で安全に使えるようにエスケープします。

文字列を Bourne シェルのコマンドライン中で安全に使えるようにエスケープします。

@param str エスケープの対象となる文字列を指定します。
@return エスケープされた文字列を返します。

例:
require 'shellwords'

pattern = 'Jan 15'
puts "grep #{Shellwords.shellescape(pattern)} file"
# => grep Jan\ 15 file

CGI.escapeHTML(string) -> String (37234.0)

与えられた文字列中の '、&、"、<、> を実体参照に置換した文字列を新しく作成し返します。

与えられた文字列中の '、&、"、<、> を実体参照に置換した文字列を新しく作成し返します。

@param string 文字列を指定します。

require "cgi"

p CGI.escapeHTML("3 > 1") #=> "3 &gt; 1"

print('<script type="text/javascript">alert("警告")</script>')

p CGI.escapeHTML('<script type="text/javascript">alert("警告")</script>')
...

CGI.escape_html(string) -> String (37234.0)

与えられた文字列中の '、&、"、<、> を実体参照に置換した文字列を新しく作成し返します。

与えられた文字列中の '、&、"、<、> を実体参照に置換した文字列を新しく作成し返します。

@param string 文字列を指定します。

require "cgi"

p CGI.escapeHTML("3 > 1") #=> "3 &gt; 1"

print('<script type="text/javascript">alert("警告")</script>')

p CGI.escapeHTML('<script type="text/javascript">alert("警告")</script>')
...

CGI.unescapeHTML(string) -> String (37231.0)

与えられた文字列中の実体参照のうち、&amp; &gt; &lt; &quot; と数値指定がされているもの (&#0ffff など) を元の文字列に置換します。

与えられた文字列中の実体参照のうち、&amp; &gt; &lt; &quot;
と数値指定がされているもの (&#0ffff など) を元の文字列に置換します。

@param string 文字列を指定します。

require "cgi"

p CGI.unescapeHTML("3 &gt; 1") #=> "3 > 1"

絞り込み条件を変える

CGI.unescape_html(string) -> String (37231.0)

与えられた文字列中の実体参照のうち、&amp; &gt; &lt; &quot; と数値指定がされているもの (&#0ffff など) を元の文字列に置換します。

与えられた文字列中の実体参照のうち、&amp; &gt; &lt; &quot;
と数値指定がされているもの (&#0ffff など) を元の文字列に置換します。

@param string 文字列を指定します。

require "cgi"

p CGI.unescapeHTML("3 &gt; 1") #=> "3 > 1"

WEBrick::HTTPUtils.#escape_path(str) -> String (36925.0)

与えられた文字列を数値参照文字列に変換します。

与えられた文字列を数値参照文字列に変換します。

以下の正規表現を使用して変換します。

num = '0123456789'
lowalpha = 'abcdefghijklmnopqrstuvwxyz'
upalpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
mark = '-_.!~*\'()'
unreserved = num + lowalpha + upalpha + mark
/[^#{Regexp.escape(unreserved + ":@&=+$,")}]/n

@param str 文字列を指定します。...

ERB::Util.#html_escape(s) -> String (27931.0)

文字列 s を HTML用にエスケープした文字列を返します。

文字列 s を HTML用にエスケープした文字列を返します。

文字列 s 中に含まれる &"<> を、実体参照 &amp; &quot; &lt; &gt; にそれぞれ変更した文字列を返します
(CGI.escapeHTMLとほぼ同じです)。

@param s HTMLエスケープを行う文字列

//emlist[例][ruby]{
require "erb"
include ERB::Util

puts html_escape("is a > 0 & a < 10?")
# is a &gt; 0 &amp; a &lt; 10?
//}

WEBrick::HTTPUtils.#escape8bit(str) -> String (27607.0)

与えられた文字列を数値参照文字列に変換します。

与えられた文字列を数値参照文字列に変換します。

@param str 文字列を指定します。

Gem::RemoteFetcher#unescape(str) -> String (27604.0)

URI 文字列をデコードした文字列を返します。

URI 文字列をデコードした文字列を返します。

@param str 文字列を指定します。

@see URI.unescape

絞り込み条件を変える

WEBrick::HTTPUtils.#unescape(str) -> String (27604.0)

与えられた文字列を数値参照文字列から元の文字列に変換します。

与えられた文字列を数値参照文字列から元の文字列に変換します。

@param str 文字列を指定します。

正規表現 (265.0)

正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references

正規表現
* metachar
* expansion
* char
* anychar
* string
* str
* quantifier
* capture
* grouping
* subexp
* selector
* anchor
* cond
* option
* encoding
* comment
* free_format_mode
* absenceop
* list
* specialvar
* references


正規表現(regular expression)は文字列のパタ...