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. |
![]() |
#1 | Link |
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. |
![]() |
![]() |
![]() |
#2 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,439
|
Quote:
Code:
global __ord_ASCII__ = __ord_ASCII__ + chr(i) |
|
![]() |
![]() |
![]() |
Tags |
ascii, character, chr, gscript, ordinal |
Thread Tools | Search this Thread |
Display Modes | |
|
|