Posted on 2004-08-08
Last Modified: 2010-04-05
Hi, i have a routine that goes like this,

If (Pos('astring', S) = 0) Then
do something

How can i tell if the pos ('astring') is uppercase or lowersase in  S?
Question by:herd_bone
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 11745652

  if Pos('ASSTRING', UpperCase(S))=0) then


Author Comment

ID: 11745782
thanks, will that still exclude lowercase strings, i need to exclude both in my routine.
without doing this for example for every string:
 if Pos('ASSTRING', UpperCase(S))=0) then
 if Pos('astring', lowerCase(S))=0) then
LVL 11

Expert Comment

ID: 11745912
try doing

if( ( Pos('ASSTRING', UpperCase(S))=0) or ( Pos('astring', lowerCase(S))=0)) then
LVL 12

Accepted Solution

esoftbg earned 85 total points
ID: 11746021
I think it is not necessary:

if ( ( Pos('ASSTRING', UpperCase(S))=0) or ( Pos('astring', LowerCase(S))=0)) then

it is enough:

if  ( Pos('ASSTRING', UpperCase(S))=0) then

let see an example:

  BUpp:  Boolean;
  BLow:  Boolean;
  BUpp := ( Pos('KYLIE', UpperCase(Kylie Minogue))=0);  // BUpp := False;
  BLow := ( Pos('kylie', LowerCase(Kylie Minogue))=0);  // Blow := False;

It is not necessary the check both of variants because they are equal.
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11749186
And what's wrong with:

 if Pos(UpperCase('AsString'), UpperCase(S))=0) then


Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 104
Print Graphic and Text to Epson TM-T88v 12 257
QRReport  TQrmemo vertical stretching 1 46
drawing animated level bar based on numbers 3 97
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question