Trim Function

  • Thread starter Thread starter cmdolcet69
  • Start date Start date
C

cmdolcet69

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
 
cmdolcet69 said:
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?
 
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
 
Back
Top