-
Notifications
You must be signed in to change notification settings - Fork 1.1k
字符串相关语法
wuzhun.wz edited this page Jun 12, 2018
·
1 revision
foo = "foo bar stuff";
aStr = "ABCD";
aChar = aStr.charAt(0);
value = Integer.valueOf(aChar);
result = foo.length==13 && foo.indexOf("bar")==4 &&
foo.substring(8,13)=="stuff" && foo.substr(-3) == "uff" && aChar == 'A' &&
Integer.valueOf(aChar)==65;
console.log('string 测试 ' + (result ? '成功' : '失败'));
function toMethod(event)
{
var i;
var j = event.length;
var ch;
var ret = '';
for(i=0; i<j; i++){
ch = event.charAt(i);
if( ch == '/' )
ret = ret + '.';
else
ret = ret + ch;
}
return ret;
}
var events = [
"thing/event/property/post"
];
result = ( 'thing.event.property.post' == toMethod(events[0]) )
console.log('string 测试 ' + (result ? '成功' : '失败'));
console.log( toMethod(events[0]) );
| Home | Tutorial | Hardware | Porting Guide | Utilities | API Reference | Technical Docs | Certification |
Crafted with ❤️ by AliOS Things Team.