weightString method

String weightString(
  1. String _aS,
  2. List<String> _wordList
)

Same as above, but with no prints.

Implementation

String weightString(String _aS, List<String> _wordList) {
  String _retS = '';
  String _t = '';
  //  String _t was meant for temporary modifying.  To avoid unused;
  _t;
  StringBuffer buf = new StringBuffer();
  //  NULL Safety     List<String> sL = new List();
  List<String> sL = [];
  //  Collect to String ONLY #command words from String _aS
  sL.addAll(_aS.split(' '));
  for (var x in sL) {
    if (lt.countStrInList(_wordList, x) > 0) {
      //  String word = x;
      //  String wordLengthS = x.length.toString();
      buf.write(x);
      buf.write(' ');
    }
  }
  _retS = buf.toString();
  return _retS; //  Might be many words in this String.
}