Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

In English Please?!

Posted on 2009-03-30
3
Medium Priority
?
174 Views
Last Modified: 2012-05-06
Hi guys,

Can someone comment this thoroughly please - I'm a new admin picking up old code :(

500 easy ones.
if len(strjob)>62 then
			
			val=instr(strJob, " - ")
			if val > 2 then strJob=left(strJob, val-1)
		end if
		val=instr(strJob, "-")
		if val > 0 then
			if mid(strJob,1,val-2) = mid(strJob,val+2,len(strJob)) then	strJob=mid(strJob,1,val-2)
		end if

Open in new window

0
Comment
Question by:Pearl_export_ben
[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
3 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 2000 total points
ID: 24018252
Inst function
http://msdn.microsoft.com/en-us/library/8460tsh1(VS.80).aspx

Mid Function (Visual Basic)  
http://msdn.microsoft.com/en-us/library/05e63829(VS.80).aspx

Left function
http://msdn.microsoft.com/en-us/library/y050k1wb(VS.80).aspx
' check if the length of the string in strJob is longer than 62 charachters
if len(strjob)>62 then
  ' search the position of " - "
  val=instr(strJob, " - ")
  '  if position  is greather than 2, then take only the characters left from the string " - "
  if val > 2 then 
       strJob=left(strJob, val-1)
  end if
 ' search the position of "-"
  val=instr(strJob, "-")
  if val > 0 then
   '  if position  is greather than 0
     if mid(strJob,1,val-2) = mid(strJob,val+2,len(strJob)) then	
          strJob=mid(strJob,1,val-2)
   end if

Open in new window

0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24018295
When you get the chance, change the name of the variable 'val'. Val is a function name. It extracts a numerical value from the left hand of a String.
0
 
LVL 8

Author Closing Comment

by:Pearl_export_ben
ID: 31564297
Fantastic - commented thoroughly and quickly as requested, thankyou :)
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

610 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