如何测试函数返回false?

时间:2016-09-13 18:12:55

标签: vbscript

有人可以告诉我什么

if(!IsNumeric(aNumber))
{
   do something
}

是否在有效的VBScript中?我试过了

!IsNumeric(aNumber)   

已经。

1 个答案:

答案 0 :(得分:3)

逻辑否定运算符在VBScript中被称为the localToScreen methods

>> For Each e In Split("1 a 2")
>>   If Not IsNumeric(e) Then
>>      WScript.Echo e, "not a number"
>>   Else
>>      WScript.Echo e, "a numerical string"
>>   End If
>> Next
>>
1 a numerical string
a not a number
2 a numerical string
>>

第二个样本:

import java.util.concurrent.*;

import java.util.*;

public class InvokeAllDemo{
    public InvokeAllDemo(){
        System.out.println("creating service");
        ExecutorService service = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());

        List<MyCallable> futureList = new ArrayList<MyCallable>();
        for ( int i=0; i<10; i++){
            MyCallable myCallable = new MyCallable((long)i);
            futureList.add(myCallable);
        }
        System.out.println("Start");
        try{
            List<Future<Long>> futures = service.invokeAll(futureList);  
        }catch(Exception err){
            err.printStackTrace();
        }
        System.out.println("Completed");
        service.shutdown();
    }
    public static void main(String args[]){
        InvokeAllDemo demo = new InvokeAllDemo();
    }
    class MyCallable implements Callable<Long>{
        Long id = 0L;
        public MyCallable(Long val){
            this.id = val;
        }
        public Long call(){
            // Add your business logic
            return id;
        }
    }
}