你很困惑path!
和file!
系列,它们可以看起来很相似,但是它们的性质有很大的不同。
甲path!
是用斜线符号分隔值(通常word!
值)的集合,一个file!
是char!
值的集合。 file!
系列中的斜杠字符只是字符,因此file!
对任何子结构都没有任何了解。它具有(主要)string!
系列的语义,而path!
具有block!
系列的语义。
现在,这个被清除,对test/1/2
结果,在file!
一系列路径符号具有比上string!
不同的行为,它会做一个聪明的串联而不是充当访问的。它被称为智能,因为它将很好地处理左侧和右侧部分中存在的额外斜线字符。例如:
>> file: %/index.html
== %/index.html
>> path: %www/
== %www/
>> path/file
== %www/file
>> path/:file
== %www/index.html
相同的路径符号规则适用于url!
系列太:
>> url: http://red-lang.org
== http://red-lang.org
>> url/index.html
== http://red-lang.org/index.html
>> file: %/index.html
== %/index.html
>> url/:file
== http://red-lang.org/index.html
因此,对于改变test: [%a/b]
嵌套内容,file!
主要表现为string!
,你可以使用任何可用的方法字符串来修改它。例如:
>> test: [%a/b]
== [%a/b]
>> change skip test/1 2 %c
== %""
>> test
== [%a/c]
>> change next find test/1 slash "d"
== %""
>> test
== [%a/d]
>> parse test/1 [thru slash change skip "e"]
== true
>> test
== [%a/e]
'解析测试/ 1 [THRU斜线变化到结束的“e”]'是我需要。谢谢 –