【问题标题】:How to check in a string after the whitespace any character is there or not in flutter?如何在空格后检查字符串是否存在任何字符?
【发布时间】:2022-11-15 14:31:19
【问题描述】:

如果空格后有任何字符,我需要检查一个字符串。如果不存在,我需要修剪并删除最后一个空格。

我使用 trim() 方法绑定,但在这种情况下,它将修剪剩余部分是空格后出现的任何字符。

【问题讨论】:

  • 你能包括样本数据吗

标签: flutter dart


【解决方案1】:
String text="name is n";
  print(text.split(" ").last.isEmpty);

如果最后一个值为假,那么最后一部分中有字符并执行您想要的任何操作,希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-19
    • 2017-02-01
    • 1970-01-01
    • 2021-06-12
    • 1970-01-01
    • 1970-01-01
    • 2011-03-15
    • 2022-06-25
    相关资源
    最近更新 更多