get the whole word string after finding the word in a text

i have a problem developing this function, i have this text..

Testing Function
ok
US.Cool
rwgehtrhjyw54 US_Cool
fhknehq is ryhetjuy6u24
gflekhtrhissfhejyw54i

my function :

function TForm5.FindWordInString(sWordToFind, sTheString : String): Integer;
var
i : Integer; x:String;
begin
 Result := 0;
 for i:= 1 to Length(sTheString) do
   begin
    x := Copy(sTheString,i,Length(sWordToFind));
    if X = sWordToFind then
      begin
        if X.Length > sWordToFind.Length then
         begin
          Result := 100;
          break;
         end else

         begin
          Result := i;
          break;
         end;
       end;
   end;
end;

now, i want X to be US.Cool, but here its always = US, because i want to check the length of sWordToFind and X.