Copy link to clipboard
Copied
405-FW
438-FG
I have a case where I need to to trim the last three characters off
<%= RTrim(rsRecordset.Fields.Item("Column"), -3 .Value)%>
I tried the above but it did not like this.
Any ideas?
Copy link to clipboard
Copied
Are you looking to trim last three characters out of six every time or does prefix character length vary? It should be easy to force three character display using scripting which will effectively trim the last three off... I can google a code for you if you are having trouble finding something yourself.
Copy link to clipboard
Copied
Every string in the results will need to have exactly 3 characters taken off so it's really quite straight forward.
I've tried google myself but have not found anything that works.
Copy link to clipboard
Copied
It's a million years since I last used VBScript, but RTrim removes spaces from the end of a string.
If you want to remove the last three characters, you could do it this way:
There might be a more elegant way to do it, but my recollection of VBScript was that "elegant" wasn't part of its vocabulary.
Copy link to clipboard
Copied
<%= Right(rsRecordsetName.Fields.Item("ColName", 3).Value)%>
Of course this didn't work.
I've tried variations on this but I can't get any to work.
Copy link to clipboard
Copied
Wish I could help more. It's phenomenally simple in PHP:
substr($value, 0, -3);
Maybe time to come over to the sunny side of the street?
Copy link to clipboard
Copied
David,
I've started building new stuff in PHP but for work, it's all ASP and I'm not ready to rebuild the store in PHP yet.
I wish I could just leave ASP behind but I'm forced to keep it going.
Copy link to clipboard
Copied
Hi,
<%= RTrim(rsRecordsetName.Fields.Item.Value), 3 %>
Try this, It's been awhile since I asp'd
Copy link to clipboard
Copied
I've tried that. Didn't work. Thanks