Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Strings

Posted on 2004-08-08
5
Medium Priority
?
186 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
[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
  • Learn & ask questions
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

610 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