Hi All, I have written the below program to find the substring in the string. in case one word coming multiple time how to handle this situation ? the below program retuning -1 as position which is wrong.
How to fixi it ?Code
Input ("abhijit" , "jit") public int FindSubString(string strSuper, string strSub) { char[] charSuper = strSuper.ToCharArray(); char[] charSub = strSub.ToCharArray(); //int position = -1; for (int i = 0; i <= charSuper.Length - charSub.Length; i++) { int counter = 0; for (int J = 0; J < charSub.Length; J++) { if (charSuper[i] != charSub[J]) continue; else { i++; counter++; } } if (counter == charSub.Length) position = i - charSub.Length; } return position; }
How to find out second maximum number in c#?
Reference variable of interface
It is possible to create the reference variable of an interface which is 100% abstract in nature.Then why it is not possible to create a reference of an abstract class?
How to clear screen using c# console application...?Like clrscr() in c++..!
Console.Clear(); its work absolute in c# "c# using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication9 { class stud...
To clear the screen we can use the clrscr() command followed by ; to clear the input given to the program
What is reflection and assembly?
Fetching the assembly information at runtime
Wap on 3d matrix by using random function print o/p in a file.
Wap on 3d matrix by using random function print in a file. find the prime numbers from out put of above program. find the even numbers from o/p of 1st program. find the odd numbers from o/p of 1st program.
What is multicast delegate? When it is used?
delegate is a type-safe pointer to a method
Delegate is used like as a method for method.
Need a program to search a word with all its synonymous ex : if I write screen find all that match of screen , lcd, monitor ,------ and so on
How to convert string to integer without using any builtin functions ?
I tihnk they want to see if you can manually convert the string..."c# int nResult = 0; int nNeg = '-'; int nMin = '0'; int nMax = '9'; bool bNegate = false; for(int i =0; i < sStr...
string test = "100"; int test1 = Convert.ToInt32(test); Console.Write(test1); Console.Read();
How to convert sting to integer without using library function?
int myStr = Int32.Parse("-105");
How many types of constructor are in c#? What are they?
C# supports two types of constructor.
1. A class constructor (static constructor)
2. An instance constructor (non-static constructor)
How to implement Ajax in c#?
Download ajax toolkit. Add "AjaxControlToolkit.dll" to our project..
C# program to count first 50 number divisible by 3
How to write c# program to count first 50 number divisible by 3 or 4.How to write c# program to count first 50 number divisible by 3 and 4.
Code
int counter = 0; int no = 1; while(counter != 50) { if(no% 3 == 0) { counter++; no++; } else no++; }
What is windows service? Can we develop windows service using c#? If yes, how? How to install or start windows service?
Wcf webservice and rest webservice
What is extension of file? What is wcf webservice? How to call webservice? How to call method of webservice? What is rest webservices?
What is the use of jscript? How to get value of input tag? How to change inner value of div tag from Javascript.
How to debug c# web application?
C# error - overload for method
I took a button in form.I have two classes emp and bonus.Bonus class is inherited from emp class.If bonus is giving ie in dialog box if we select ‘yes’ b ie bonus is added to sal and we get ts ie total sal along with eno.If bonus is not given ie in dialog box if we select ‘no’ we need to get...
Here you are passing parameters to the class itself...
You have to pass the parameters to method.
Hi aarruunnaa,You try this code, if it is useful for you send me reply otherwise ask me again dont hesitate class emp {public int eno,sal; public emp(){}public emp(int eno,int sal) {this.eno=eno;...
How to declare two or more methods in c# program..How to implement that methods in the c# program
How to create static objects in c#?