Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Instr to pick out words in Uppercase in a string 1

Status
Not open for further replies.

dawnyanne

Technical User
Nov 1, 2006
34
GB
Hi

Is it possible to use instr to pick out words that are capitalised eg if a field has

bought 800 BANK OF AMERICA 5.60 ON 27/4/96

I want to be able to pick out the 'BANK OF AMERICA' part.
I have a lot of fields all with varying details and so the capitalised detail doesnt always appear in the same place so the only way to pick this data out is by the capitalisation.

I am using crystal version 8.5

any help would be very much appreciated!
thank you in advance
Dawnyanne
 
You need to be more specific. Why wouldn't you want 'ON' returned? How could words like "ON" be distinguished from the ones you do want? What if only the first letter of a word is capitalized? What would you expect to be returned--just that letter or the entire word?

-LB
 
Hi Lbass!

sorry the ON wouldnt be capitalised it would just be the name of the bank for example - so I just need everything in the field that is in uppercase to be selected. There wont be any other text in the field that has the first letter capitalized so its just a case of picking out all of the words in uppercase.

thank you so much for your help

Dawnyanne
 
First go into file->report options and make sure that 'Database server is case-insensitive' is unchecked.

Then create a formula like this:

stringvar array x := split({table.string}," ");
numbervar i;
numbervar j := ubound(x);
stringvar y := "";
for i := 1 to j do(
if not isnumeric(x[1]) and
x = ucase(x then
y := y + x + " "
);
y

-LB
 
Thank you so much!!!

Works perfectly! You are an absolute star!

thanks again

Dawnyanne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top