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.

Hi,

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

img20211109-2

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

Regards,

Thank you .

And what does (“.”, C) do?

Hi,

"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("."))

Regards,

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