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
``````
LVL 8
###### Who is Participating?

Commented:
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
``````
0

RetiredCommented:
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

Author Commented:
Fantastic - commented thoroughly and quickly as requested, thankyou :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.