Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

int start=FileArr.LastIndexOf('.');

file=FileArr.Remove(start, FileArr.Length);

 

In bold is the problem. I cannot figure out a way for Remove to just go to the end of the sting, without going through alot more trouble. There should be some kind of method to do it but what is it. .Length returns the length of the whole string and an error is produced.

C#
Posted

Remove's second parameter is the length of the substring to remove?

 

Then that would be:

file=FileArr.Remove(FileArr.LastIndexOf('.'), FileArr.Length - FileArr.LastIndexOf('.')+1);

 

(I suppose)

.nerd

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...