gpt4 book ai didi

ruby - 在哪里可以找到 Ruby 文档中的字符串转义序列?

转载 作者:数据小太阳 更新时间:2023-10-29 06:56:34 24 4
gpt4 key购买 nike

我可以在“Ruby Strings”和“Escape sequences”中找到有关 Ruby 转义序列的详细信息。但是,在官方 Ruby 文档的哪个位置可以找到有关字符串转义序列的详细信息?

这个问题对于刚刚学习 Ruby 的人来说很重要,因为了解如何简单地浏览文档是一个初始挑战。

最佳答案

请参阅official documentation (或在 ruby-doc.org 上)已更新为支持的转义字符的完整列表:

\a             bell, ASCII 07h (BEL)
\b backspace, ASCII 08h (BS)
\t horizontal tab, ASCII 09h (TAB)
\n newline (line feed), ASCII 0Ah (LF)
\v vertical tab, ASCII 0Bh (VT)
\f form feed, ASCII 0Ch (FF)
\r carriage return, ASCII 0Dh (CR)
\e escape, ASCII 1Bh (ESC)
\s space, ASCII 20h (SPC)
\\ backslash, \
\nnn octal bit pattern, where nnn is 1-3 octal digits ([0-7])
\xnn hexadecimal bit pattern, where nn is 1-2 hexadecimal digits ([0-9a-fA-F])
\unnnn Unicode character, where nnnn is exactly 4 hexadecimal digits ([0-9a-fA-F])
\u{nnnn ...} Unicode character(s), where each nnnn is 1-6 hexadecimal digits ([0-9a-fA-F])
\cx or \C-x control character, where x is an ASCII printable character
\M-x meta character, where x is an ASCII printable character
\M-\C-x meta control character, where x is an ASCII printable character
\M-\cx same as above
\c\M-x same as above
\c? or \C-? delete, ASCII 7Fh (DEL)

如果您发现任何需要添加或修复的内容,我们欢迎通过 GitHub 上的拉取请求或我们的 issue tracker 提供反馈和贡献.

关于ruby - 在哪里可以找到 Ruby 文档中的字符串转义序列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19743964/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com