Solved

Get string from middle of phrase

Posted on 2011-09-20
4
198 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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