我查看了ruby中URI类的文档,但找不到从实例中提取锚点(HTML)的方法.例如,在
http://example.com/index.php?q=something#anchor
Run Code Online (Sandbox Code Playgroud)
我想得到anchor文字.简单的解决方案是使用正则表达式操作文本,但如果有一些方法,那么它会好得多.
>> uri = URI("http://example.com/index.php?q=something#anchor")
>> uri.fragment
=> "anchor"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1341 次 |
| 最近记录: |