This is more of a solution to your problem than an answer to your question.
If the trailing space is not needed you can remove it/them with STRIM:

(STRIM(text))

Trims trailing blanks from text, returning a text string.

In the following example, the value of vstrim is the text string ABCDE without the trailing blanks.

SET VAR vstrim = (STRIM('ABCDE '))


If the last char is a legitimate space, you could test the last character of the string:
vLastChar = (SGET(TextString,1,(SLEN(TextString))))

Doug

On 12/10/2015 12:30 AM, md wrote:

Hello,

           I need your help to know if the behavior of the function is
correct.  If it is correct then I can use your help with a work around to
identifying a space as the last character of a string.  Your help is greatly
appreciated.

I need to read the value entered by a user one character at a time so that
on each keystroke a search is perform on a table.  Everything work well
unless the search involved more than one word.  Function (SCLOC(String,' '))
does not work if the space is the last character of the String.

Examples:

String = 'RBASE Application'

(SCLOC(.String,' ')) = 6

String = 'RBase '

(SCLOC(.String,' ')) = 0

When a space is the last character of the string it is not recognized by
SLOC, SLOCP, or SLOCI.  I am not sure if this is the correct behavior of
these functions.  Any Blues Clues?

I am using:

R:BASE eXtreme 9.5 (32), U.S. Version, Build: 9.5.5.21111

Thank you,

Manuel de Aguiar V





---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Reply via email to