I am afraid you have completely misunderstood the meaning of the logical operators and, or, and not. These are not used with strings, but with booleans (logical values, which are either true or false).
not is a unary operator which returns true if the operand is false, and returns false if the operand is true. Thus, not true yields false, and not false yields true.
For example, if you have a boolean variable PasswordTooSimple (the typed password is too simple), you might want to set CanContinue := not PasswordTooSimple somewhere in your logic.
and is a binary operator on booleans, which returns true if and only if both of its operands are true. For example, CanContinue := ValidUser and not PasswordTooSimple.
or is a binary operator on booleans, which returns true if and only if at least one of its operands is true. For example, CanContinue := (PaymentComplete or NoncommersialVersion) and not PasswordTooSimple.
If PaymentComplete, NoncommersialVersion and PasswordTooSimple are false, true, and false, respectively, then, applying these rules, we find that PaymentComplete or NoncommersialVersion will evaluate to true, that not PasswordTooSimple will evaluate to true, and -- therefore -- the entire expression (PaymentComplete or NoncommersialVersion) and not PasswordTooSimple = true and true = true, so that CanContinue will be true. For example, you might have btnContinue.Enabled := CanContinue.
By the way, now you know what the compiler means by "Operator not applicable to this operand type". Indeed, the error message is spot on: the not operator is not applicable to string operands.
notdoes not apply to strings. What do you want to do?NOT. It doesn't work the way you think it does. You should read the documentation for the language elements you are trying to use. You need to isolate the substring before the@character first. Right now your code makes no reference to the'@'character or its ASCII representation, so that's an inhibitor to doing step 1. Once you isolate the substring before the@then you can get the first and last two characters of that substring using string functions.