Last post Jul 28, 2014 01:26 PM by null_name
Member
32 Points
53 Posts
Jul 27, 2014 04:50 PM|null_name|LINK
string file = GridView.DataKeys[e.Row.RowIndex].Values[1].ToString();
string[] File_Extenention= file.Split('.');
if (File_Extenention.Length > 1)
{//do some code}
what does this line if (File_Extenention.Length > 1) mean ?
All-Star
101931 Points
20703 Posts
Jul 27, 2014 04:58 PM|MetalAsp.Net|LINK
File_Extenention is an array. That line of code is checking if the array has any elements in it. So basically making sure that the split() "worked"?
52523 Points
15672 Posts
Jul 27, 2014 05:06 PM|oned_gk|LINK
Jul 27, 2014 05:13 PM|null_name|LINK
elements of what ? it all have only .pdf or .doc
how it will know if that file has data or not !
Jul 27, 2014 05:16 PM|MetalAsp.Net|LINK
Gogle/bing string.Split(). Maybe that will clarify what I'm trying to tell you.
Contributor
3054 Points
1018 Posts
Jul 28, 2014 11:04 AM|wim sturkenboom|LINK
'hallo.txt' will be split into 'hallo' and 'text'; the split() returns an array with 2 strings.
'hallo.null_name.txt' will be split into 'hallo', 'null_name' and 'txt'; the split() returns an array with 3 strings.
if (File_Extenention.Length > 1) { }
If there is more than one element in the array, the file has an extension.
Jul 28, 2014 01:26 PM|null_name|LINK
thanks wim
Member
32 Points
53 Posts
if (File_Extenention.Length > 1)
Jul 27, 2014 04:50 PM|null_name|LINK
string file = GridView.DataKeys[e.Row.RowIndex].Values[1].ToString();
string[] File_Extenention= file.Split('.');
if (File_Extenention.Length > 1)
{//do some code}
what does this line if (File_Extenention.Length > 1) mean ?
All-Star
101931 Points
20703 Posts
Re: if (File_Extenention.Length > 1)
Jul 27, 2014 04:58 PM|MetalAsp.Net|LINK
File_Extenention is an array. That line of code is checking if the array has any elements in it. So basically making sure that the split() "worked"?
All-Star
52523 Points
15672 Posts
Re: if (File_Extenention.Length > 1)
Jul 27, 2014 05:06 PM|oned_gk|LINK
dot. If the value contain filename
with extension will be splitted into
two parts or more.
Suwandi - Non Graduate Programmer
Member
32 Points
53 Posts
Re: if (File_Extenention.Length > 1)
Jul 27, 2014 05:13 PM|null_name|LINK
File_Extenention is an array. That line of code is checking if the array has any elements in it. So basically making sure that the split() "worked"?
elements of what ? it all have only .pdf or .doc
how it will know if that file has data or not !
All-Star
101931 Points
20703 Posts
Re: if (File_Extenention.Length > 1)
Jul 27, 2014 05:16 PM|MetalAsp.Net|LINK
Gogle/bing string.Split(). Maybe that will clarify what I'm trying to tell you.
Contributor
3054 Points
1018 Posts
Re: if (File_Extenention.Length > 1)
Jul 28, 2014 11:04 AM|wim sturkenboom|LINK
'hallo.txt' will be split into 'hallo' and 'text'; the split() returns an array with 2 strings.
'hallo.null_name.txt' will be split into 'hallo', 'null_name' and 'txt'; the split() returns an array with 3 strings.
If there is more than one element in the array, the file has an extension.
Member
32 Points
53 Posts
Re: if (File_Extenention.Length > 1)
Jul 28, 2014 01:26 PM|null_name|LINK
thanks wim