Solved

Strings

Posted on 2004-08-08
5
176 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:mnasman
Comment Utility
Try

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

0
 

Author Comment

by:herd_bone
Comment Utility
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
Comment Utility
try doing

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

Accepted Solution

by:
esoftbg earned 85 total points
Comment Utility
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
Comment Utility
And what's wrong with:

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

Hmmm???
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now