Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to split dot and take right side value in the list...

C#
List<string> amt=new List<string>();
            amt.Add("Rs.649");
            amt.Add("Rs.649");
            amt.Add("Rs.600");           
            amt.Add("Rs.500");

I want to take 649,649,600,500 separate

How to do it Please help..
Posted
Updated 30-Dec-13 23:27pm
v3
Comments
Karthik_Mahalingam 31-Dec-13 5:20am    
please add more info..
post your code..
Karthik_Mahalingam 31-Dec-13 5:22am    
like this?
lst.Select(k => k.Split('.')[1]).ToList();

C#
List<string> amt = new List<string>();
       amt.Add("Rs.649");
       amt.Add("Rs.649");
       amt.Add("Rs.600");
       amt.Add("Rs.500");
       string output ="";
       amt.Select(k => k.Split('.')[1]).ToList().ForEach(k => { output += k + ","; });
       output = output.Trim(',');
 
Share this answer
 
Comments
TrushnaK 31-Dec-13 5:57am    
nice answer...
Karthik_Mahalingam 31-Dec-13 6:50am    
thanks trushnak
BillWoodruff 31-Dec-13 6:08am    
+5 Yes !
Karthik_Mahalingam 31-Dec-13 6:50am    
thanks bill :)
USE THE FOLLOWING CODE

string result="";
foreach(var v in amt)
{
string[] s=v.split('.');
result+=S[1];
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900