473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Trim Function

I ahve the following code that need to trim off the last character
from a string

dim STR as string
If instr(STR <3 then
LTrim(STR)
THis code doesn;t work
Sep 18 '08 #1
3 1595

"cmdolcet69" <co************@hotmail.coma écrit dans le message de news:
95**********************************...oglegroups.com...
>I ahve the following code that need to trim off the last character
from a string

dim STR as string
If instr(STR <3 then
LTrim(STR)
THis code doesn;t work
1 - STR is a reserved name, use mySTR for example
2 - The line instr(STR <3 is incomplete and meaningless
3 - "Ltrim" just removes leading spaces
4 - It looks like you might be using VB6, is this the case?
Sep 18 '08 #2
ats
On Thu, 18 Sep 2008 07:19:16 -0700 (PDT), cmdolcet69 wrote:
I ahve the following code that need to trim off the last character
from a string

dim STR as string
If instr(STR <3 then
LTrim(STR)
THis code doesn;t work
I think the TRIM() function only gets rid of whitespace. Try the LEFT$()
function:

dim STR as string
STR= "STRING"
STR = LEFT$(STR,3)

HTH
--
ats@jbex

Boats an' tanks and planes, it's your game
Kings an' queens an' generals learn your name
I see all the innocents, the human sacrifice
And if death comes so cheap
Then the same goes for life!

The Clash - Tommy Gun
Sep 18 '08 #3
What if you try STR=LTrim(STR) ? Remember that this is a function i.e it
don't change the argument. It *returns* a modified string.

--
Patrice
"cmdolcet69" <co************@hotmail.coma écrit dans le message de groupe
de discussion :
95**********************************...oglegroups.com...
I ahve the following code that need to trim off the last character
from a string

dim STR as string
If instr(STR <3 then
LTrim(STR)
THis code doesn;t work

Sep 18 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Robert Mark Bram | last post by:
Hi All, I am using the following trim function: function trim (str) { return str.replace(/^\s*/g, '').replace(/\s*$/g, ''); } The problem is that this doesn't trim instances of the...
7
by: Sascha Herpers | last post by:
Hi, what is the difference between the trim function and the trim String-member? As far as I see it, both return the trimmed string and leave the original string unaltered. Is any of the two...
22
by: Terry Olsen | last post by:
I have an app that makes decisions based on string content. I need to make sure that a string does not contain only spaces or newlines. I am using the syntax 'Trim(String)" and it works fine. I...
12
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I trim whitespace - LTRIM/RTRIM/TRIM?...
5
by: Marjeta | last post by:
I'm trying to very that the user actually entered something in the form, and not just spaces. I guess the problem is in the first line of isBlank() function. I've tried the following:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.