What does this code do

Hi All,

I am learning UiPath and the tutorial is not clear for me. We try to get the file names with the command below without extension.

Could you please let me know what the command below does?

File.Name.Substring(0, File.Name.LastIndexOF("."c))

I appreciate any help you can provide.


Probably the File is Fileinfo instance.
The expression returns file name without extension as the following.


FYI, this is same as System.IO.Path.GetFileNameWithoutExtension(File.FullName)


Thank you .

And what does (".", C) do?


"x"C means Char type literal in VB.net. In this case , it works in both String and Char. So the following will also work.

File.Name.Substring(0, File.Name.LastIndexOF("."))


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.