473,394 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

I am unable to understand why this use of Substring does not work

Looking at the watch window, I have
----------------watch window-----------------------
ix 6 int
tStr "hyphen, and )(*" string

tStr.Substring(0,ix) error:'tStr.Substring' does not exist
---------------------------------------------------
I have no errors in the compile, and the following works:

string s="1234567890";
s=s.Substring(0,6)
----------------watch window-----------------------
s.Substring(0,6) "123456"
---------------------------------------------------

Thanks
Feb 4 '07 #1
2 1319
intrader wrote:
Looking at the watch window, I have
----------------watch window-----------------------
ix 6 int
tStr "hyphen, and )(*" string

tStr.Substring(0,ix) error:'tStr.Substring' does not exist
---------------------------------------------------
I have no errors in the compile, and the following works:

string s="1234567890";
s=s.Substring(0,6)
----------------watch window-----------------------
s.Substring(0,6) "123456"
---------------------------------------------------

Thanks
I think I figured out. It appears that the IDE is paying attention to
the generated code.

The full expression I have is

tStr=tStr.Subsring(0,ix) + tStr(ix+1, tStr.Length-1);

which causes the index to be out of the string.

The expression should be

tStr=tStr.Subsring(0,ix) + tStr(ix+1, tStr.Length-ix-1);

Thanks for anyone looking at this.
Feb 4 '07 #2
intrader wrote:
intrader wrote:
>Looking at the watch window, I have
----------------watch window-----------------------
ix 6 int
tStr "hyphen, and )(*" string

tStr.Substring(0,ix) error:'tStr.Substring' does not exist
---------------------------------------------------
I have no errors in the compile, and the following works:

string s="1234567890";
s=s.Substring(0,6)
----------------watch window-----------------------
s.Substring(0,6) "123456"
---------------------------------------------------

Thanks
I think I figured out. It appears that the IDE is paying attention to
the generated code.

The full expression I have is

tStr=tStr.Subsring(0,ix) + tStr(ix+1, tStr.Length-1);

which causes the index to be out of the string.

The expression should be

tStr=tStr.Subsring(0,ix) + tStr(ix+1, tStr.Length-ix-1);

Thanks for anyone looking at this.
That's why I coldn't see anything wrong with the code you posted... :)

--
Göran Andersson
_____
http://www.guffa.com
Feb 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Nancy | last post by:
Hi, When I start my PC(winXP Pro), it always says: Unknown(): Unable toload dynamic library './php_msql.dll' - The specified module could not be found. Then my Apache servre starts, load php...
7
by: Philip Herlihy | last post by:
If I'm reading my reference books correctly, I should be able to pick out cells in a table by combining a <col> selector with a class selector, like this: col#thisid td.thisclass {color: red; }...
1
by: tshad | last post by:
I have a string that I am trying to strip the last 2 characters that happen to be a "," and a " ". I am also adding a "<br>" to the end. When I am done I still have the ", " and also the <br>. ...
4
by: jjouett | last post by:
I have the following input XML: <?xml version="1.0"?> <ordersubmit xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
9
by: Jim in Arizona | last post by:
I get this error: Unable to cast object of type 'System.Web.UI.HtmlControls.HtmlInputText' to type 'System.Web.UI.WebControls.TextBox'. Using this code: Dim test3 As TextBox test3 =...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
2
by: falconite | last post by:
In a perl script, I'm reading in data from a mysql server database that has some fields that could be millions of bytes long (DNA sequences). However, I am interested only in the first 1000 or so...
1
by: Benedict Verheyen | last post by:
Hi, i get an "Unable to relay for" when trying to send an email from within my network to an email address not on my domain. I don't understand why it says "relaying" as i'm sending from an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.