program yang;
#include ( "stdlib.hhf" )
static
Astring: string := "yangzhiyong";
begin yang;
mov(Astring, eax);
mov(0, dl);
mov( (type str.strRec [eax]).length, ecx);
for ( mov(0, esi); esi<ecx; inc(esi) ) do
mov( [eax+esi], dl);
stdout.put("Astring[", (type uns32 esi), "] = ", (type char dl), nl);
endfor;
end yang;
二:
program yang;
#include ( "stdlib.hhf" )
static
Astring: string := "yangzhiyong";
Bstring: string := "ljy520zhiyong";
begin yang;
mov(Bstring, ebx);
mov(0, dl);
str.length( ebx );
mov(eax, ecx);
for ( mov(0, esi); esi<ecx; inc(esi) ) do
mov( [ebx+esi], dl);
stdout.put("Astring[", (type uns32 esi), "] = ", (type char dl), nl);
endfor;
end yang;
本文通过两个示例展示了如何在自定义的编程环境中进行字符串的操作,包括遍历字符串并将字符逐一输出到标准输出设备的过程。第一个示例针对单个字符串进行操作,而第二个示例则比较了两个不同的字符串。
67

被折叠的 条评论
为什么被折叠?



