Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Get first word in a string


'Everything that precedes the first space is the first word
'First use Trim$ to remove leading spaces
MyString = LTrim$(MyString)
FirstWord = Left$(MyString, Instr(MyString, " " ) - 1)