Solved

# Strings

Posted on 2004-08-08
180 Views
Hi, i have a routine that goes like this,

//---
S:=list.Strings[I];
If (Pos('astring', S) = 0) Then
do something
//---

How can i tell if the pos ('astring') is uppercase or lowersase in  S?
0
Question by:herd_bone
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 22

Expert Comment

ID: 11745652
Try

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

0

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

0

LVL 11

Expert Comment

ID: 11745912
try doing

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

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:

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

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

LVL 17

Expert Comment

ID: 11749186
And what's wrong with:

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

Hmmm???
0

## Featured Post

Question has a verified solution.

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

### Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
###### Suggested Courses
Course of the Month6 days, 14 hours left to enroll