如何将TCL列表转换为PHP可以读取的字符串? [英] How do you convert a TCL list into a string that PHP can read?
问题描述
我有一个TCL过程,需要将可能是列表的内容转换成
字符串才能读取
考虑到这一点:
[set string [PROPER_CASE {hello world}]]; #OUTPUTS Hello World
适用于PHP
[set string [PROPER_CASE {-hello world}]]; #OUTPUT {{-Hello}}
World,PHP将按字面打印为{{-Hello}}世界,而不是
-Hello World
TCL是否有一种简单的方法可以将列表暴力破解为
严格字符串格式,以防止这种可能难看的显示
从PHP /等显示?
Thanx
Phil
在文章< 11 ********************** @ e56g2000cwe.googlegroups .com> ;,
comp .lang.tcl< ph ************** @ gmail.com>写道:我有一个TCL proc需要将可能是一个列表转换成
字符串来读取
考虑这个:
[set string [PROPER_CASE {hello world}]]; #OUTPUTS Hello World,这对于PHP来说是好的
[set string [PROPER_CASE {-hello world}]]; #OUTPUT {{-Hello}}
世界,PHP将字面打印为{{-Hello}}世界,而不是
- 你好世界
有没有简单的方法TCL蛮力将列表强制为
严格字符串格式,以防止这种可能难看的显示被PHP /等显示。
>
不确定PROPER_CASE是什么确实..
但是,我想你想看一下加入命令(你可能需要多次调用
)。
%set s" {{ - Hello}} World"
{{-Hello}}世界
%加入
s
{-Hello} World
%加入[加入
s]
-Hello World
MH
I have a TCL proc that needs to convert what might be a list into a
string to read
consider this:
[set string [PROPER_CASE {hello world}]]; # OUTPUTS Hello World which
is fine for PHP
[set string [PROPER_CASE {-hello world}]]; # OUTPUT {{-Hello}}
World, which PHP will print literally as {{-Hello}} World, instead of
-Hello World
Is there an easy way for TCL to brute-force a list into a
strictly-string-only format to prevent this potentially ugly display
from being displayed by PHP/etc.?
Thanx
Phil
In article <11**********************@e56g2000cwe.googlegroups .com>,
comp.lang.tcl <ph**************@gmail.com> wrote:I have a TCL proc that needs to convert what might be a list into a
string to read
consider this:
[set string [PROPER_CASE {hello world}]]; # OUTPUTS Hello World which
is fine for PHP
[set string [PROPER_CASE {-hello world}]]; # OUTPUT {{-Hello}}
World, which PHP will print literally as {{-Hello}} World, instead of
-Hello World
Is there an easy way for TCL to brute-force a list into a
strictly-string-only format to prevent this potentially ugly display
from being displayed by PHP/etc.?
Not sure what "PROPER_CASE" does..
However, I think you want to look at the "join" command (you may need to call
it multiple times).
% set s "{{-Hello}} World"
{{-Hello}} World
% join
s
{-Hello} World
% join [join
s]
-Hello World
MH
这篇关于如何将TCL列表转换为PHP可以读取的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!