Hi everyone,
I've got a new version of ElfData out. ElfData v5.3
For those who don't know, ElfData is the most advanced string
processing library for REALbasic. Giving the most speed, assuming it's
used correctly. Of course, used incorrectly, it will be slower.
read about: http://elfdata.com/plugin/
download: http://elfdata.com/plugin/elfdata.zip
technical ref: http://www.elfdata.com/plugin/technicalref
What's so special about this version compared to the previous version?
Well... I've added one new function. But whats special is that I more
fully documented many functions that were written long ago and got
only brief or no documentation.
I spent a long time writing this page up:
http://www.elfdata.com/plugin/technicalref/ElfDataMCat16.html
This page explains all about how to use ElfData's "unixy" file
processing functions.
There's also that really neat little example I discovered recently,
that I could count the number of lines in a file, in three lines of
ElfData code, and do it 2.5-5x faster than REALbasic could do it, even
though REALbasic required many times more lines.
dim fi as ElfDataFields = SomeFolderItem.ElfDataFields
call fi.MoveNext( ElfData.kEnd ) // kEnd is the biggest number an
integer can handle
MsgBox str( fi.Count ) + " lines found in " + fi.file.Path
Of course that's not the only thing ElfData can do faster, ElfData can
do thousands of things faster than REALbasic, usually at least 2x
faster, but often running into 10, 100, or even 1000x faster. (1000x
or more faster would be my "multiple replace all" class that does
stuff that would be a nightmare without it.)
I also fixed one bug with operator_convert, that didn't produce bad
results, but operator_convert ran on comparing "ElfData1 <> ElfData2"
when it wasn't meant to. That's been fixed now and designed properly.
Anyhow, the main thing is now people can have a central place to look
at to see what file processing functions ElfData has. Because of how
simple these functions make some tasks, I was able to write a program
to check if all the files passed, were UTF-8, ASCII, or neither. And
do it recursively over directories. And all of that, in about 30 lines
of code. Example below:
Sub ProcessFile(path as ElfData)
dim e as ElfData = path.FileListing( 10, true )
if e <> nil then // it's a folder
dim fi as ElfDataFields = e.Lines
While fi.MoveNext
ProcessFile fi
wend
Return
end if
dim data as ElfData = path.FileData
if data = nil then
stdout.Write "Unreadable"
elseif data.IsASCII then
stdout.Write "ASCII"
elseif data.Verify = 0 then
stdout.Write "UTF-8"
else
stdout.Write "Not_ASCII_Or_UTF-8"
end if
stdout.Write chrb(9)
stdout.WriteLine path
End Sub
Function Run(args() as String) As Integer
// copy this code into the "Run" event of a shell (console) project
for i as Integer = 1 to UBound( args )
dim fi as ElfDataFields = args( i ).ElfData.Lines
While fi.MoveNext
ProcessFile fi
wend
next
End Function