Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

list - how to filter the text string and make a new string in flutter

I want to make a new String after splitting the existing String and searching it through all the Lists existing. The only elements which exist in the the Lists should make the New String. Below is the code in flutter. I am able to break the existing String into List of elements and now I want to search all splitted elements whether they exist in the predefined lists or not. Only those elements which exist in the predefined lists should be used to make the new String

Please guide me how can I do this.

  List A = ["ra", "rb", "rc", "rd", "re"];
  List B = ["rf", "ra", "rh", "ri", "rj"];
  List C = ["k", "l", "m", "of", "o"];
  List D = ["p", "q", "r", "s", "a"];
  List E = ["a", "9", "5", "u", "z"];

String text = "h a s q ra rc";
    List newText =  text.toLowerCase()
        .split(' ')                       // split the text into an array
        .map((String text) => Text(text)) // put the text inside a widget
        .toList();
question from:https://stackoverflow.com/questions/65858108/how-to-filter-the-text-string-and-make-a-new-string-in-flutter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...