vipcxj Posted November 2, 2011 Share Posted November 2, 2011 First: int iLengthstring_var strTest let strTest := "%e"let iLength := sv_Length strTest the iLength is 2 but 0. this is strange~~~and, let strTest += "Test"let iResult := sv_Compare "Test" The "iResult" is not 0. And,let strTest := "%e"let iResult := sv_Compare "%e" strTest The "iResult" is not 0, too. The only way to test a empty string I have found is that: "sv_Compare $stringForTest stringForTest != 0"Only for empty string, this exper is true. Second: let arArr := ar_Map "a":1 "b":2 "c":3ForEach arIter <- arArr let strKey := arIter["key"] ar_Erase arArr strKeyLoop Only element "a":1 will be deleted.It is said that loop is executed only once.The correct way to do this is that: let iIdx := 0let iSize := ar_Size arArrif iSize > 0 let strKey := ar_First arArr while iIdx < iSize let strNext := ar_Next arArr strKey ar_Erase arArr strKey let strKey := strNext let iIdx += 1 loopendif Link to comment Share on other sites More sharing options...
QQuix Posted November 2, 2011 Share Posted November 2, 2011 (edited) int iLengthstring_var strTest let strTest := "%e"let iLength := sv_Length strTest the iLength is 2 but 0. this is strange~~~and, It is correct. "%e" only translates as "" when used as a format string let strTest += "Test"let iResult := sv_Compare "Test" The "iResult" is not 0."let strTest += "Test"" should be " let strTest := "Test" let strTest := "%e"let iResult := sv_Compare "%e" strTest The "iResult" is not 0, too.let strTest := ""let iResult := sv_Compare "%e" strTest Returns 0, as "%e', now is a format string and is equal to strTest (="") The only way to test a empty string I have found is that: "sv_Compare $stringForTest stringForTest != 0"Only for empty string, this exper is true.if eval strTest == "" ; works let arArr := ar_Map "a":1 "b":2 "c":3ForEach arIter <- arArr let strKey := arIter["key"] ar_Erase arArr strKeyLoop I think scruggsy said this should work but, as you said, it does not.I will try to find his comment in the OBSE forum. Clarified with scruggsy and added to the WIKI Edited November 3, 2011 by QQuix Link to comment Share on other sites More sharing options...
Recommended Posts