From Avisynth wiki
Revision as of 21:18, 25 May 2020 by Reel.Deal
Simple plugin to produce formatted string, and additional function to string replace with another string.
- *** vcredist_x86.exe is required for StrFmt-x86
- *** vcredist_x64.exe is required for StrFmt-x64
StrFmt(String format, dat1,...,datn) Returns a formatted string. The unnamed 'format' string and optional unnamed 'dat' args are used to construct the text string that is returned, uses C/CPP printf() style formatting. Format: compulsory string controlling format and describing the datn type args that are expected. datn: Variable number of data args of any type (excluding clip). printf Format spec here:- http://msdn.microsoft.com/en-us/library/56e442dc%28v=vs.71%29.aspx NOTE, the only support for printing Bool variables is %s as string, ie prints "True" or "False". Formatting supported, %[flags] [width] [.precision] type flags, one of "-,+,0, ,#" width, integer, "*" supported (width supplied via dat arg). Precision, integer, "*" supported (precision supplied via dat arg). type, "c,C,d,i,o,u,x,X", Integer type, c,C=character, d,i=signed, o,u,x,X=unsigned (o=octal, x=Hex). "e,E,f,g,G", Floating point type "s,S", String type (also Bool). Formatting Insertion point is marked with '%' character in the format string (as in Avisynth String function), if you wish to use a percent character within the returned string, it should be inserted twice in the format string ie '%%' will produce a single '%'. The data datn arg strings do not require a double '%' character. A Backslash character '\' introduces escape sequences, to insert a backslash character itself, you must supply a double backslash sequence ie '\\'. Converts embedded escape character sequences (Case Significant):- '\\' Converted to '\' Single Backslash '\n' Converted to Chr(10) NewLine '\r' Converted to Chr(13) Carriage Return '\t' Converted to Chr(9) Horizontal TAB '\v' Converted to Chr(11) Vertical TAB '\f' Converted to Chr(12) FormFeed '\b' Converted to Chr(8) BackSpace '\a' Converted to Chr(7) Bell '\x', where x is ANY OTHER CHARACTER not included above, will be copied verbatim, ie '\x'. eg StrFmt("Hello there %s and %s.\nGoodbye %d.","Fred","Ted",2019) would return same as:- "Hello there Fred and Ted." + Chr(10) + "Goodbye 2019." ***** ***** ***** StrRep(string source,string find,string replace,bool "sig"=True) # Based on Algorithm by Vampiredom, Gavino & IanB. String args 'source', 'find' and 'replace' unnamed and compulsory. Takes a source string, searches for all occurences of find string and replaces the found strings with the replace string. Can use "" in replace string (only in replace) to delete the found substrings from the source string. Newlines [Chr(10)] are treated no differently to other characters, and could be replaced/deleted. 'sig' arg,default true is Case Significant. Set false for case insignificant find string.
07 June 2017. V0.0 Initial release. 29 July 2017, v0.01. Fixed print character from buffer after buffer released. 14 Jan 2019, v1.00. Move to VS2008, Added Version Resource, add x64 dll.
Back to External Filters ←