使用谷歌的移动视觉api只检测数字?

Rah*_*zes 5 android-vision

我想知道如何过滤以仅检测数字(整数)?例如 1,2,....,10。目前 api 检测所有格式的“文本”。

Jal*_*lle 0

您应该在您这边进行该处理。使用正则表达式从 Vision API 收到的字符串中过滤掉数字:

str="Text received 123,0";
number = str.replace(/\D/g,'');

result: 123
Run Code Online (Sandbox Code Playgroud)