?
Solved

Strings

Posted on 2004-08-08
5
Medium Priority
?
188 Views
Last Modified: 2010-04-05
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
Comment
Question by:herd_bone
5 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 11745652
Try

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

0
 

Author Comment

by:herd_bone
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

by:Jase-Coder
ID: 11745912
try doing

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

Accepted Solution

by:
esoftbg earned 340 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

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

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

Hmmm???
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

850 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