Remove first and last character of a value

Hi all,

How can I remove the first and last character of a filed value using lotusscript? I looked at the forum but I did not succeded with the task.

,First value,Second value,third vlaue,fourthvalue,

regards,

p.

Subject: Remove first and last character of a value

origstring$ = "Hello Central"newstring1$ = Left(origstring$, Len(origstring$) -1)

finalstring$ = Right(newstring1$, Len(newstring1$) - 1)

or

string2$ = Mid(mystring$, 2, Len(mystring$) - 2)

I bet there are simpler ways, too. To avoid errors, you should make sure the original string length > 2.

Subject: Remove first and last character of a value

Great it is working…

I was basically trying with Evaluate… and it did not work for me, but I must be useing it the wrong way… Well thanks…

so now i have a sting like;

thisFirst value,Second value,third vlaue,fourthvalue

I need to put the 4 values in an array, would I have to use the len function again or is there a better way to do that?

thanks

p.

Subject: RE: Remove first and last character of a value

Now I’m a bit confused. Do you want to remove the first and last VALUES from a 4-value field, or are you talking about removing single characters?

Subject: RE: Remove first and last character of a value

Well first I needed to remove the first and last comma then put the string in an array…

Subject: RE: Remove first and last character of a value

for that matter you can do it simply like this

xstring$ = “,First value,Second value,third vlaue,fourthvalue,”

temp = Split(xstring$, “,”)

temp = Fulltrim(temp)

Fulltrim eliminates the empty strings in the array

Subject: RE: Remove first and last character of a value

wow all done in one shot ! thanks a lot…

Subject: RE: Remove first and last character of a value

use the Split function

Split(xstring$, “,”)

Subject: Remove first and last character of a value

assuming the first and last character are always a comma and you are trying to strip the leading and trailing comma …

xstring$ = “,First value,Second value,third vlaue,fourthvalue,”

xstring$ = Strleftback(xstring$, “,”)

xstring$ = Strright(xstring$, “,”)

Msgbox xstring$

Subject: Remove first and last character of a value

Seems you could use len to determine the length (assuming you don’t know it, than right or left to capturre the remainder.