Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 30th December 2011, 22:38   #1  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
ord() | Return the ASCII value of a character

Here is a useful function I wrote for returning to ASCII value of a character, like the reverse of chr()

Note that AviSynth seems to ignore CHR(0) in strings ... A blank string will always return 0.

Code:
# requires Gscript.dll
global __ord_ASCII__ = ""

function ord(string c) {
        c = LeftStr(c,1)
        
        Gscript("""
        if (__ord_ASCII__ == "") {
                for (i=1, 255, 1) {
                        global __ord_ASCII__ = __ord_ASCII__ + chr(i)
                }
        }
        """)
        
        return (c == "") ? 0 : FindStr(__ord_ASCII__, c)
}

Last edited by vampiredom; 30th December 2011 at 23:19.
vampiredom is offline   Reply With Quote
 

Tags
ascii, character, chr, gscript, ordinal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.