Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 如何在dart中获取从右到特定字符的所有字符_String_Flutter_Dart_Substring - Fatal编程技术网

String 如何在dart中获取从右到特定字符的所有字符

String 如何在dart中获取从右到特定字符的所有字符,string,flutter,dart,substring,String,Flutter,Dart,Substring,我试图从下面的字符串中获取从右到“*”的所有字符 字符串phoneNumber='07******253' 在这里,我希望子字符串为'253' 例如:“07******4253” 结果:4253您可以使用split()拆分字符串 或者与regexp相同 RegExp reg = RegExp(r'[^*]*$'); var _matched = reg.allMatches(_phone); _matches.last.group(0); RegExp reg =

我试图从下面的字符串中获取从右到“*”的所有字符

字符串phoneNumber='07******253'

在这里,我希望子字符串为'253'

例如:“07******4253”
结果:4253

您可以使用split()拆分字符串

或者与regexp相同

   RegExp reg = RegExp(r'[^*]*$');
    var _matched = reg.allMatches(_phone);

    _matches.last.group(0);
   RegExp reg = RegExp(r'[^*]*$');
    var _matched = reg.allMatches(_phone);

    _matches.last.group(0);