Click here to Skip to main content
15,908,166 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hiii all
i make a for loop on datatable and take one row from it calling path which looks like that string "1/2/3/4/7"

i want to know the lenght of that string???
i tried to get the last index of "/" , but i found that i want the whole length of the string.


So , any help , please??

Thanks
Posted
Updated 27-Sep-11 4:21am
v2
Comments
Sergey Alexandrovich Kryukov 27-Sep-11 12:47pm    
My reason of voting "1": this is just beyond good and evil. Is it extreme laziness or something else, but certainly extreme. What's to point to go into ASP.NET development?
--SA

 
Share this answer
 
Comments
moon2011 27-Sep-11 10:26am    
thanks
Hi,

try this to get lenght of string

C#
string str = "1/2/3/4/7";
        int ttl = str.Length;
        string[] resstr = str.Split('/');
        int rwcnt=resstr.Length;


In the above code ttl means length of string including '/'
and rwcnt means length means excluding '/'


All the Best
 
Share this answer
 
Comments
moon2011 28-Sep-11 3:06am    
thanks, my 5

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