Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove a string at the end of a string
#1
I wonder whether there exists a QM function to remove a certain string (right trim a string) at the end of a string.

I have written the following member function. Any advice is mostly welcome.

Member function str.RStrim
Code:
Copy      Help
function str'sRtrim
str s=this
int l=s.len-sRtrim.len
_i=find(s sRtrim l)
if _i<0; ret
s.remove(_i)
this=s
ret
#2
my version

Member function str.RStrim
Code:
Copy      Help
function$ $sRtrim

if(this.end(sRtrim)) this.remove(this.len-len(sRtrim))

ret this
#3
Thank you ! it is perfect. I like very much this "end" function. Best regards.


Forum Jump:


Users browsing this thread: 1 Guest(s)