How to remove all whitespace of a string in Dart?

后端 未结 7 1947
半阙折子戏
半阙折子戏 2021-02-07 10:31

Using trim() to eliminate white space in Dart and it doesn\'t work. What am I doing wrong or is there an alternative?

       String product = \"COC         


        
7条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-07 11:12

    You can try this:

    String product = "COCA COLA";
    
    print(product.split(" ").join(""));   // COCACOLA
    

提交回复
热议问题