.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Asp.net Replace Function

Posted By: Naresh     Posted Date: July 14, 2010    Points:2   Category :ASP.Net
Hi,

I have a String;

name[0]="(s)sixth myelomatosis trial (s)for previously untreated patients: ABCM with or without clodronate"

name[1]="Randomised controlled(s) trial of bezafibrate in patients with lower extremity "


Here i want to replace "(s)" which is coming in the first Position only.


I need the result as,

name[0]="sixth myelomatosis trial (s)for previously untreated patients: ABCM with or without clodronate"

name[1]="Randomised controlled(s) trial of bezafibrate in patients with lower extremity "


Iam Storing the data in array.

Iam using C#.net and sql Server.



Thanku in advance


Responses
Author: Akhil Raj       [Moderator]      
Posted Date: July 14, 2010     Points: 5   

if i understand correctly you need to remove the (s) only in the first. Please use Remove

eg: String sample = "(s)This is sample(s) text";
sample = sample.Remove(0, 3);

Author: Syed Shakeer Hussain             
Posted Date: July 15, 2010     Points: 5   

Hi,
String s1=String.Empty;
String [] sample="(s)sixth myelomatosis trial (s)for previously untreated patients: ABCM with or without clodronate;
for(int i=0;i <3;i++)
{
s1=s1+str[i];
}
if("(s)"==s1)
{
sample = sample.Remove(0, 3);
}
else
{
sample;
}




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend