Need some help
Author Message
Need some help

Hello all,

I want to take out some numbers out of a line from the right side,

For example my line is 0123456789 and I want to
take out from right position 1,2,3 and 5 so that the result is 5789

I can not use the function Mid (. . . . .) because that is taking out
from the left side of the line.

Does anybody know a solutio"?

Sat, 25 Oct 2003 17:41:40 GMT
Need some help
Use the Right() function...

Paul.

Quote:
> Hello all,

> I want to take out some numbers out of a line from the right side,

> For example my line is 0123456789 and I want to
> take out from right position 1,2,3 and 5 so that the result is 5789

> I can not use the function Mid (. . . . .) because that is taking out
> from the left side of the line.

> Does anybody know a solutio"?

Sat, 25 Oct 2003 18:12:44 GMT
Need some help
Of course you can use Mid().
Just substract 1,2,3 and 5 (taken from your example) to the LENGTH of your
string:
(Len(string)+1) -1, (Len(string)+1) -2, (Len(string)+1) -3,
(Len(string)+1) -5.

Sat, 25 Oct 2003 19:14:49 GMT
Need some help

Reverse the string

myStr = "1234565789"
newStr = ""

for x = len(myStr) to 1 step -1
newStr = newStr & mid(Mystr,x,1)
next x

now myStr is equal to 987654321

and you can work with mid

Frank.

Sat, 25 Oct 2003 19:40:03 GMT
Need some help

Quote:

> Reverse the string

> myStr = "1234565789"
> newStr = ""

> for x = len(myStr) to 1 step -1
>     newStr = newStr & mid(Mystr,x,1)
> next x

> now myStr is equal to 987654321

> and you can work with mid

> Frank.

It would be better to dimension the string before entering the loop:

myStr = "1234565789"
newStr = myStr
x = Len(myStr)  + 1
for i = 1 To x - 1
Mid(newStr, i, 1) = Mid\$(myStr, x - i, 1)
next i

LFS

Wed, 29 Oct 2003 22:42:07 GMT

 Page 1 of 1 [ 5 post ]

Relevant Pages