I think this horse has been beaten before many times. RBase automagically removes trailing blanks AFAIK.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of md Sent: Thursday, December 10, 2015 6:43 PM To: [email protected] Subject: [RBASE-L] - Re: Function SLOC cannot find a trailing space. Hello Doug, Appreciate you responding to my email. I am curious to confirm if in fact in your computer SLEN recognizes the space at the end of a text string because it does not in mine computers. SET VAR vTxt TEXT = 'RBASE ' <== ending space In my computer both: (SLEN(.vTxt)) = 5 and (SLEN('RBASE ')) = 5 Returns the value five (5) It should return the value six because of the ending space but the ending space is simply ignored. Do you mind testing this on your computer with your version of RBase and let me know if you get a length of 5 or six which would include the ending space? I would appreciated before I start looking for a workaround for this challenge. I will gladly share my workaround if in fact RBase's functions do not recognize an ending space on a string. Thank you, Manuel From: [email protected] [mailto:[email protected]] On Behalf Of Doug Hamilton Sent: Thursday, December 10, 2015 7:27 AM To: [email protected] Subject: [RBASE-L] - Re: Function SLOC cannot find a trailing space. 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 <https://www.avast.com/?utm_medium=email&utm_source=link&utm_campaign=sig-em ail&utm_content=emailclient> Image removed by sender. This email has been sent from a virus-free computer protected by Avast. <https://www.avast.com/?utm_medium=email&utm_source=link&utm_campaign=sig-em ail&utm_content=emailclient> www.avast.com

