04-03.eri-test 차이차이

2015年4月6日10:30:11来自blog。hazard。kr

1。==!=연산자

닷넷

닷넷은==로오버字符串等于비교값의동일성을。

자바

자바는이클래며며며며특성상레퍼런동일한동일한동일한불가불가。
개발자가개발자字符串等于용사용。

2。+연산자

닷넷:

串s=“asd”+b+“qwe”; //>>串s=串。康卡特(“asd”,b,“ qwe”);

串。cs
。NETconcat원리

[System安全安全性安全关键]  //自动生成上市 静态的  Concat str0  str1 {// 合同는Test및유효성사검스를스클래스임。合同确保合同.结果<>() != 空值);合同.确保合同.结果</string><string>().长度 ==str0 == 空值  0 : str0.长度) +str1 == 空值  0 : str1.长度));Contract.EndContractBlock();如果 IsNullOr空的str0)) {如果 IsNullOrEmptystr1)) {返回 .Empty;}返回 str1;}如果 IsNullOrEmptystr1)) {返回 str0;}整型 str0长度 = str0.长度;//.NET네이티브를가다가포인터에이를자리자리자 结果 = FastAllocateString(str0Length + str1.Length);//그리고다가순서대로삽입FillStringChecked(结果 0str0);FillStringChecked(结果, str0Length, str1);//그리하여포인터。返回 结果;}

자바:

String s = "asd" + b + "qwe";
//>> String s = new StringBuffer().append("asd").append(b).append("qwe").toString();

StringBuffer.java
자바는문자열 증가 연산자 약속을 StringBuffer있음스를원리는차이가있음。

합치기문자열이점이점

插图:길이만큼리만큼를를음음음음음결과값결과값음음음음음음음음음음
자바:StringBuffer출력자를를를필요필요필요필요증증후후후음음음음음음음음음음음음음음음음음음음음음음음음음음음음 (기본값은+16)

합치합치기합치

반복문 등에서 문자열 추가시 닷넷은StringBuilder,자바는StringBuffer득이것이득。

여기까지。

from: https://dev.to//composite/-596p

发布了0 篇原创文章 · 获赞 0 · 访问量 124

猜你喜欢

转载自blog.csdn.net/cunbang3337/article/details/105560034
今日推荐