D语言字符串比较

import std.stdio; 

void main() { 
   string s1 = "Hello"; 
   string s2 = "World";
   string s3 = "World";

   if (s2 == s3) { 
      writeln("s2: ",s2," and S3: ",s3, "  are the same!"); 
   }

   if (s1 < s2) { 
      writeln("'", s1, "' comes before '", s2, "'."); 
   } else { 
      writeln("'", s2, "' comes before '", s1, "'."); 
   }
}

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/265988.html

(0)
上一篇 2022年6月7日
下一篇 2022年6月7日

相关推荐

发表回复

登录后才能评论