Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
技术板块灌水区
» MicroTip#2:将中或英字符串转换为 Delphi 的 Dfm 格式
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: MicroTip#2:将中或英字符串转换为 Delphi 的 Dfm 格式
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#1
Post at 2007-3-12 08:46
Profile
|
Blog
|
P.M.
|
MicroTip#2:将中或英字符串转换为 Delphi 的 Dfm 格式
// MicroTip#2:将中或英字符串转换为 Delphi 的 Dfm 格式
// Test in Delphi6's Dfm
// Wrtten by SkyJacker 2007.03.05
// QQ Discuss Group: 130970
// 将中或英字符串转换为 Delphi 的 Dfm 格式
// Ex: 'CnPack Delphi '#20195#30721#24341#25806' V1.0' . Maybe you can reverse it!
function StrToDfmFmt(const AStr: string): string;
const
QM = '''';
var
W: WideString;
I: Integer;
bEn: Boolean;
Len: Integer;
begin
bEn := False;
W := AStr;
Len := Length(W);
for I:=1 to Len do
begin
if Ord(W
)>127 then // 如果为非普通 ascii,就认为是宽字符
begin
if bEn then
Result := Result + QM;
Result := Result + '#' + IntToStr(Ord(W[I]));
bEn := false;
end
else
begin
if not bEn then
Result := Result + QM + W
else
Result := Result + W
;
if I = Len then
Result := Result + QM;
bEn := true;
end;
end;
end;
一壶清茶煮青春.
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#2
Post at 2007-3-12 09:25
Profile
|
Blog
|
P.M.
if Ord(W)>127
这个用法还真新鲜。
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#3
Post at 2007-3-12 09:42
Profile
|
Blog
|
P.M.
|
阿.
我的原文是:
if Ord(W
)>127 then // 如果为非普通 ascii,就认为是宽字符
我是先放在 UE 中再Copy的.
难道弄丢了.
上面的Ord(W)就不改了,当作一个小后门吧。
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#4
Post at 2007-3-12 09:43
Profile
|
Blog
|
P.M.
|
Discuz 过滤了.
阿.
我的原文是:
if Ord(W { i })>127 then // 如果为非普通 ascii,就认为是宽字符
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#5
Post at 2007-3-12 09:44
Profile
|
Blog
|
P.M.
|
W[I]
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#6
Post at 2007-3-12 09:44
Profile
|
Blog
|
P.M.
|
(W[I])
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#7
Post at 2007-3-12 09:44
Profile
|
Blog
|
P.M.
|
Ord(W[I])
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#8
Post at 2007-3-12 09:45
Profile
|
Blog
|
P.M.
|
Ord(W[I]) >
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#9
Post at 2007-3-12 09:45
Profile
|
Blog
|
P.M.
|
if Ord(W
)>127
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#10
Post at 2007-3-12 09:46
Profile
|
Blog
|
P.M.
|
Ord(W
)>127
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#11
Post at 2007-3-12 09:46
Profile
|
Blog
|
P.M.
|
(W
)>127
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#12
Post at 2007-3-12 09:49
Profile
|
Blog
|
P.M.
|
总结:
Discuz! 5.0.0 会过滤类似于以下字符串:
(W{I})>127
"{}" 实际为 "[]"
Thx Passion!
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#13
Post at 2007-3-12 10:04
Profile
|
Blog
|
P.M.
|
让此帖作为我的灌水测试帖吧
小于
(W[I]) < 127
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#14
Post at 2007-3-12 10:05
Profile
|
Blog
|
P.M.
|
(W[I]) and (W[I]) > 127
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#15
Post at 2007-3-12 10:05
Profile
|
Blog
|
P.M.
|
((W[I]) and (W[I])) > 127
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#16
Post at 2007-3-12 10:06
Profile
|
Blog
|
P.M.
|
((W[I]) && (W[I])) > 127
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#17
Post at 2007-3-12 10:06
Profile
|
Blog
|
P.M.
|
W[ I ] > 127
一壶清茶煮青春.
skyjacker
版主
茶农
UID 2239
Digest Posts
9
Credits 617
Posts 269
点点分 617
Reading Access 100
Registered 2006-6-8
Status Offline
#18
Post at 2007-3-12 10:07
Profile
|
Blog
|
P.M.
|
(W[ I ])>127
一壶清茶煮青春.
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#19
Post at 2007-3-12 11:57
Profile
|
Blog
|
P.M.
明白了, 得禁用DISCUZ! 代码,否则那个方括号I就被当成斜体了。
kendling
(小冬)
高级版主
MyvNet
UID 703
Digest Posts
5
Credits 978
Posts 580
点点分 978
Reading Access 101
Registered 2005-2-18
Location 广东
Status Offline
#20
Post at 2007-3-14 10:00
Profile
|
Site
|
Blog
|
P.M.
|
|
怪不得看起来怪怪的。
小冬
http://MyvNet.com
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-22 13:22
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.010287 second(s), 9 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats