How to split specific file name from string.
for e.g C:\Users\DEEP\Desktop\IDM\zip\ExcelCompare\04-12-2018.xlsx
it is the string and i want to extract the date from here only
How to split specific file name from string.
for e.g C:\Users\DEEP\Desktop\IDM\zip\ExcelCompare\04-12-2018.xlsx
it is the string and i want to extract the date from here only
variable.ToString.Split("".ToCharArray)(7)
You can use vb.net functions to get filename from an path without extenstion
path.GetFileNameWithoutExtension("C:\Users\DEEP\Desktop\IDM\zip\ExcelCompare\04-12-2018.xlsx")
Hey @Sandeep_Kumar2
Just Use Path.GetFileName(“C:\Users\DEEP\Desktop\IDM\zip\ExcelCompare\04-12-2018.xlsx”).
Regards…!!
Aksh
index was outside the bound of array
forward slash is not showing inside double quotes. variable.ToString.Split(“forward slash”.ToCharArray)(7)
what if i just only wanna get name not extension
Use this -
Path.GetFileNameWithoutExtension(“C:\Users\DEEP\Desktop\IDM\zip\ExcelCompare\04-12-2018.xlsx”)
This Will be helpful in all cases and not dependent on file path length ![]()
Regards…!!
Aksh
(“C:\Users\DEEP\Desktop\IDM\zip\ExcelCompare\04-12-2018.xlsx”).ToString.Split(“forward slash”.ToCharArray)(7).Split(“.”.ToCharArray)(0)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.