Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opposite of Mid() function

Status
Not open for further replies.

Albion

IS-IT--Management
Joined
Aug 8, 2000
Messages
517
Location
US
I need a function that will strip out of a randomly sized string 12 characters from the end of the string to the beginning. Does this exist?

-Al
 
Try the right() function.

Thanks and Good Luck!

zemp
 
I'm interpreting your question as how to strip the last 12 chars from the string and return the remaining chars.

strOut = Left$(strIn, Len(strIn) - 12)

where strIn contains the string to process.

Paul Bent
Northwind IT Systems
 

Hi Al:

Here's another one for your collection:

Code:
strOut = Right$(strIn, 12)

per Zemp's suggestion.

Cassie
 

Hi Al:

After re-reading your question, it is still ambiguous to me. I suspect what you want is what Paul demonstrated.

Cassie
[blush]
 
It is hard to tell if Albion wants the output to be the original string minus the twelve charaters or the last twelve charaters in the string. Either case seems to be covered.

Thanks and Good Luck!

zemp
 
I have this string "Some text being of any length 123456789ABC" I want to strip off the "123456789ABC" and return "Some text being of any length".

My solution was to do

strOut = reverse(strIn)
strOut2 = left(strOut, 13)
strOut3 = reverse(strOut2)

-Al
 
Use Mid in conjunction with Instr..

strSource = "Some text being of any length 123456789ABC"
strDelim = "123456789ABC"

strResult = Mid(strSource,1,Instr(strSource,strDelim)-1)

Make sure the Instr(strSource,strDelim)-1 does not return zero. It will cause an error.

All the best.
Sunil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top