• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 369
  • Last Modified:

instr

are there any problems in writing var1=instr(temp,".")-1
where temp is b.0, and var1 is a string. will var1 get the value 1 or 0. what happends if there is no "." in temp?
what will be the value of mid$(temp,1,instr(temp,".")-1) , is it b. thank you.
0
ilanm
Asked:
ilanm
  • 2
1 Solution
 
ilanmAuthor Commented:
Edited text of question
0
 
vmanoCommented:
the instr syntax is:
instr( start, string1, string2, compare)
string1 is your temp
string2 is the required string.

and more to follow...
0
 
vmanoCommented:
if you do var1 = instr(1,temp, ".") -1, var1 will return 1
and if there is no "." in temp, var1 will return -1
and if you do  var1 = Mid$(temp, 1, (InStr(1, temp, ".") - 1)), var1 will return "b"

0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now