analyzeStrS method
Analyze long String that can contain many #command #word's. TODO change word: _wordList TO _wordBank
Implementation
String analyzeStrS(String _anStr, List<String> _wordList) {
// print('-->>-->>-- :dawolang: analyze-Strings -->>-->>-- ');
List<String> retL = [];
retL.add(_anStr);
// assume we check String against other
String _extractS = ' *emptyAtBegin*';
String _t = '';
// String _t was meant for temporary modifying. To avoid unused;
_t;
StringBuffer buf = new StringBuffer();
buf.write(':an:buf: ');
// NULL safety List<String> _analyzeL = new List();
List<String> _analyzeL = [];
// Collect to String ONLY #command words from String _aS
_analyzeL.addAll(_anStr.split(' '));
// print(sL);
// print(sL.length);
for (var x in _analyzeL) {
// Using list_tools library
if (lt.countStrInList(_wordList, x) > 0) {
String word = x;
// Meant for more complicated use-cases. To avoid unused:
word;
String wordLengthS = x.length.toString();
// Meant for more complicated use-cases. To avoid unused:
wordLengthS;
// print('W: $word L: $wordLengthS');
buf.write(x);
buf.write(' ');
}
}
buf.write(' :done:');
// TODO From where get data to: extracted ??
// it is empty!!
_extractS = buf.toString();
String _retS = '';
// TODO Output! Where? '..:debug:dawolang:print:.:connector;opJoin:...');
retL.add(':an:aStr: :EXTRACTED::');
retL.add(buf.toString()); // for future use
String returnString = (':an:aStr:: $_anStr :EXTRACTED:: $_extractS ');
print(':an:aStr:: $_anStr :EXTRACTED:: $_extractS ');
// print(':EXTRACTED:: $_retS ');
// print('--<<--<<-- :dawolang: analyze-Strings done--<<--<<-- \n ');
// TODO PLAN: Make this return Map<String, String>
Map<String, String> _retMap = {
'inStr': '',
'rule': '',
'com': '',
'outStr': '',
};
// When in need of more complicated return value, use map.toString.
// Just to name it here to avoid unused.
_retMap;
_retS = returnString;
return _retS; // Might be many words in this String.
}