Comparing Strings

 BBS: Inland Empire Archive
Date: 07-04-92 (23:17)             Number: 2143
From: ROBERT CHURCH                Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Comparing Strings              Conf: (2) Quik_Bas
I need some help matching fixed length strings to dynamic strings.
The following is an example from a door I'm writing.  It attempts to
determine if the Name$ that a new user enters is already in use.
It always comes up false.  I assume that the problem is here:

      IF JTrim$(U.Handle) = Name$ THEN

because I've had trouble with such comparisons in the past.
In a nutshell, how can I compare a fixed length string to a dynamic one?

DEFINT A-Z
FUNCTION PlayerExist (Name$)
   DO WHILE NOT (EOF(1))
      Rec = Rec + 1
      GET #1, Rec, U
      IF JTrim$(U.Handle) = Name$ THEN
         PlayerExist = -1
         EXIT FUNCTION
      END IF
   LOOP
   PlayerExist = 0
END FUNCTION

Thanks

-Rob


DEFSNG A-Z

--- PPoint 1.33
 * Origin: Live from Hillsboro, OR.  GO BLAZERS! (1:105/319.27)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET