Simple String Question
-
Hey I need to trim 4 characters off the right hand side of my string and am having a little trouble doing so. For example "Hello.doc" becomes "Hello" I could use split at "." but this wont stay constant if there is a "." in the filename itself Thanks for your time chris
-
Hey I need to trim 4 characters off the right hand side of my string and am having a little trouble doing so. For example "Hello.doc" becomes "Hello" I could use split at "." but this wont stay constant if there is a "." in the filename itself Thanks for your time chris
Hey, Chris. You could try:
dim s1 as string = "Hello.doc";
dim s2 as string = Left(s1, Len(s1) - 4)Or, if you're dealing with file/path names and want to extract portions of it (say just the filename, or just the extension, that sort of thing) have a look at the
System.IO.Path
class. -
Hey, Chris. You could try:
dim s1 as string = "Hello.doc";
dim s2 as string = Left(s1, Len(s1) - 4)Or, if you're dealing with file/path names and want to extract portions of it (say just the filename, or just the extension, that sort of thing) have a look at the
System.IO.Path
class.Hi, I might have the similar question too. I use an OpenFileDialog for user to select the file and they select TheFile.doc, How could I know that user select file extension with .doc? Can you help that? Because I want to check the 4 character from the right side.
A thousand mile of journey, begin with the first step. APO-CEDC Save Children Norway-Cambodia Office
-
Hi, I might have the similar question too. I use an OpenFileDialog for user to select the file and they select TheFile.doc, How could I know that user select file extension with .doc? Can you help that? Because I want to check the 4 character from the right side.
A thousand mile of journey, begin with the first step. APO-CEDC Save Children Norway-Cambodia Office