Solved

vb.net - Instr question

Posted on 2010-08-12
5
407 Views
Last Modified: 2013-11-26
what does tstrx equal below?
dim tstrx as string = ""
dim strx as string = "http://shjdhncha/shgb/default.aspx"
tstrx = Mid(strx, 1 InStr(strx, "xxx") -1
0
Comment
Question by:GlobaLevel
5 Comments
 

Expert Comment

by:tyy8
ID: 33422001
This would cause an error
0
 

Expert Comment

by:tyy8
ID: 33422019
Sorry (should have added)

InStr(strx, "xxx") - 1

InStr(strx, "xxx")  is 0
InStr(strx, "xxx") - 1 is -1

There is no such point in the string as -1
0
 
LVL 27

Expert Comment

by:nmarun
ID: 33422034
0
 
LVL 16

Expert Comment

by:13598
ID: 33422107
Your length
tstrx = Mid(strx, 1, InStr(strx, "xxx") - 1)
would be 0 and you cannot have a 0 length.
It would be 0 because you are looking for 3 x in a row which don't exist in "http://shjdhncha/shgb/default.aspx"
 
What is your goal here?
0
 
LVL 17

Accepted Solution

by:
Zhaolai earned 500 total points
ID: 33422383
tstrx = Mid(strx, 1 InStr(strx, "xxx") -1
 produces two syntax errors, because it's missing a comma before InStr and missing a closing parenthesis ")" at the end.
 
 
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 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