Page 1 of 1

String Trim

Posted: Fri Jun 22, 2001 2:17 pm
by vaibhav.choksey
I want to trim the string. I get output as 2000 characters but want to trim first 500 characters.
I don't know which function to use for this.
The way I am doing is:
SELECT $$$$rank, ID, TEXT from Search where TEXT/NAME likep 'Text' order by $$$$rank;

When I excute this query I get Text in the variable $Text_s and I want to trim this $Text_s to 500 characters.
can you give me an example or explain me.
Thanks
Vaibhav

String Trim

Posted: Fri Jun 22, 2001 2:49 pm
by Kai
Use <substr> in Vortex; see http://www.thunderstone.com/site/vortexman/node113.html . Ie.:

<SQL ROW ".... your sql statement ...">
<substr $TEXT 0 500><$TEXT = $ret>
...
</SQL>

If you're using tsql, you'll have to use sandr:

select ...., sandr('>>=.{500}.+', '\2', TEXT) TEXT, ...