Solved

Strings

Posted on 2004-08-08
5
182 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 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

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

707 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