June 22nd, 2006, 11:01 AM
Remove last character from a string
How can I get a string from this
22, 32, 43, 23, 44,
22, 32, 43, 23, 44
I want to cut the last coma
Today the world, tomorrow the universe...
June 22nd, 2006, 11:15 AM
something like Left(str,Len(str)-1) ?
Comments on this post
August 17th, 2008, 05:09 PM
If you want to erase / delete last character in the last line of a text file, you can use this script:
Don't forget to replace the two "Text_File.txt" parts of this script with the correct name of the file you want to edit and also these two files have to be in the same directory otherwise you must replace the two "Text_File.txt" parts of this script with the full path of the text file you want to edit.
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("Text_File.txt", ForReading)
strFile = objFile.ReadAll
intLength = Len(strFile)
strEnd = Right(strFile, 2)
strFile = Left(strFile, intLength - 1)
Set objFile = objFSO.OpenTextFile("Text_File.txt", ForWriting)
You use the above script by pasting it to empty text file, then renaming the file's extension to ".vbs". You run it by applying cmd command :
Many other VB scripts can be found here: