Solved

Get string from middle of phrase

Posted on 2011-09-20
4
195 Views
Last Modified: 2012-05-12
What would be the most efficient way to get rid of the leading and training characters in the following string

FORM_FrmTestForm.txt

That is, get rid of the FORM_ and traling .txt to leave only FrmTestForm
0
Comment
Question by:ssmith94015
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 350 total points
Comment Utility
If the string ALWAYS has a underscore and period, AND the period always comes after the underscore...

Left(Mid(SomeString, InStr(1, SomeString, "_") + 1), InStr(1, Mid(SomeString, InStr(1, SomeString, "_") + 1), ".") - 1)
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 150 total points
Comment Utility


try this

Dim x
x = "FORM_FrmTestForm.txt"
x = Mid(x, InStr(x, "_") + 1)
x = Left(x, Len(x) - 4)


that will give you   "FrmTestForm"
0
 

Author Comment

by:ssmith94015
Comment Utility
Let me try both and be right back.
0
 

Author Closing Comment

by:ssmith94015
Comment Utility
Both worked, however I went with the one-line version in this procedure.  This scenario always has the first five and last three but I do have another process that will have variable strings.   Thank you both.

Sandra
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now