Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

how to get first word of a sentence in flutter

static String getFirstWord(String inputString) {
    List<String> wordList = inputString.split(" ");
    if (wordList.isNotEmpty) {
      return wordList[0];
    } else {
      return ' ';
    }
  }
 
PREVIOUS NEXT
Tagged: #word #sentence #flutter
ADD COMMENT
Topic
Name
7+1 =