×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

extract a string

extract a string

extract a string

(OP)
Hello world!
I want to extract a string from an other
for example dossier1\dossier2...\123-Mayrou\forum
for that I used SPLIT to extract "mayrou"

mayrou =Right(Split(productDocument1.Path,"\")(2),4)

Anybody please correct it.
Thanks in advance :)

RE: extract a string

(OP)
I want to extract a string between two
...\Mayrou\...

RE: extract a string

Depending on what you want to extract (and which language are you using, for example is much easier in vb.net) it can be done in different ways

Bellow is an example using different functions (just to understand how is working),

CODE --> vbs

Dim MyString, TrimString, RightTrimString, FinalString

MyString = "dossier1\dossier2\123-Mayrou\forum" 

MyStringNr = Len(MyString)
MsgBox MyStringNr

LeftTrimStringNr = InStr(MyString, "Mayrou")
MsgBox LeftTrimStringNr

RightTrimString=Right(MyString, MyStringNr - (LeftTrimStringNr-1))
MsgBox RightTrimString

FinalString = Left(RightTrimString,Len("Mayrou"))
MsgBox FinalString 

or in your code

CODE --> vbs

Dim MyString, FinalString

MyString = "dossier1\dossier2\123-Mayrou\forum" 
strToExtract = "Mayrou"
FinalString = Right(Split(MyString, "\")(2),Len(strToExtract))
MsgBox FinalString 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: extract a string

(OP)
thx you Fernando :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources