Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

whi this does not work?

Posted on 2004-03-31
3
Medium Priority
?
227 Views
Last Modified: 2010-04-15
string test1 = "test";
                                          string test2 = "test";

                                          int test = test1.IndexOf(test2,0);


test = 0 ?
0
Comment
Question by:alain123
[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
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
gillit earned 2000 total points
ID: 10724993
It works.

0 means the beginning of the string.

t=0
e=1
s=2
t=3

It returns where the string starts the match.
0
 
LVL 3

Expert Comment

by:gillit
ID: 10725022
IndexOf("t",0) gives 0
IndexOf("t",1) gives 3
IndexOf("e",0) gives 1
IndexOf("e",1) gives 1
IndexOf("e",2) gives -1
0
 
LVL 1

Author Comment

by:alain123
ID: 10725098
got it, thanks..
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. 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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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