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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find space at end of string

Status
Not open for further replies.
Jun 26, 2002
77
US
I have not found the solution to this one yet.

I need to test to see if a space is used in any position of a string. The instr works as long as the space is not at the end. I have tried instrrev and that does not work either. The fields I am using are first name, last name, middle name.

I am using CrystalReports 2011 against a SQL database.

Thank you in advance.
 

Just tested and instr works fine for me when the space is at the end. I would take a closer look at the data - for instance, do a len({YourField}) to be sure it's returning all the characters expected.

Also, here's a formula to return the ascii values for each character in the string - make sure it's returning a 32 for anything that appears to have a space at the end.

numbervar x;
stringvar v_ascii;
for x := 1 to len({YourField})
do
(
v_ascii := v_ascii + totext(asc({YourField}[x]),"#") + ";";
);

v_ascii
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top