×
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

.net how do I ask what a string starts with?
2

.net how do I ask what a string starts with?

.net how do I ask what a string starts with?

(OP)
Sorry if this is in the wrong forum for this question
I am writing a macro to save a SolidWorks drawing as a PDF and add some information to the filename at the same time.
I also would like it to save the file in a specific folder on the system dependant on the start of the filename.
I have the file name as a string, but I want to be able to write something along the lines of:
If the filename starts with "V", put it in this folder, else if it starts with "MD", put it in this folder, and so on, ignoring any subsequent characters in the filename.
I hope I've given enough information to be clear, any ideas anyone?
 

RE: .net how do I ask what a string starts with?

(OP)
I forgot to mention, I also need it to take the first three digits and add it to a string, so for instance if the filename is V12345, I need it to go into a folder on the system called V12000. So I will probably need a variable that is just the first 3 characters of the filename

RE: .net how do I ask what a string starts with?

(OP)
because I have no idea what that means. I should have mentioned I'm no pro when it comes to code

RE: .net how do I ask what a string starts with?

Google regular expressions and .net. You might search eng-tips or tech-tips. There are a lot of programmers and programming fora.

Anytime you have to search a string regular expressions are the way to go. They are also known as regex. They have been implemented in Windows programming languages for years.  

TOP
CSWP, BSSE
www.engtran.com  www.niswug.org
www.linkedin.com/in/engineeringtransport
Phenom IIx6 1100T = 8GB = FX1400 = XP64SP2 = SW2009SP3
"Node news is good news."

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