String manipulation

anin

Member
Joined
Feb 21, 2005
Messages
10
Programming Experience
1-3
[Resolved] String manipulation

Cud someone please tell me how to truncate the String "TESTFILE.XML" to "TESTFILE"

I want to remove the .xml from the string.

thanks,
 
Last edited:
levyuk said:
Dim s AsString = "TESTFILE.XML"
MessageBox.Show(s.Remove(8, 4))

that works, but also limits to the length of the name.ext

String.replace(".xml","") allows for a variable lenth name.ext
 
The code given above is perfectly viable.
Another alternative (always good to have alternatives) is:
VB.NET:
Dim strFileName As String = _
          System.IO.Path.GetFileNameWithoutExtension("TESTFILE.XML")
 
Back
Top