且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何仅从颤振中的字符串中提取数字?

更新时间:2023-11-07 12:46:40

以下代码可以提取该数字:

The following code can extract the number:

aStr = a.replaceAll(new RegExp(r'[^0-9]'),''); // '23'

您可以使用以下方法将其解析为整数:

You can parse it into integer using:

aInt = int.parse(aStr);