Solved

Get string from middle of phrase

Posted on 2011-09-20
4
199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 350 total points
ID: 36568017
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 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 150 total points
ID: 36568019


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
ID: 36568043
Let me try both and be right back.
0
 

Author Closing Comment

by:ssmith94015
ID: 36568095
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

691 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