StrFmt

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(StrFmt: add documentation)
 
m (Requirements)
 
(One intermediate revision by one user not shown)
Line 18: Line 18:
 
* [x64]: [[AviSynth+]]
 
* [x64]: [[AviSynth+]]
 
<br>
 
<br>
* [https://www.microsoft.com/en-us/download/details.aspx?id=11895 Microsoft Visual C++ 2008 Redistributable Package (x86 / x64)] <includeonly>[[VC_9.0]]</includeonly>
+
* [https://www.microsoft.com/en-us/download/details.aspx?id=26368 Microsoft Visual C++ 2008 Redistributable Package (x86 / x64)] <includeonly>[[VC_9.0]]</includeonly>
:<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> is required for <tt>ExactDedup-x86</tt>
+
:<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> is required for <tt>StrFmt-x86</tt>
:<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> is required for <tt>ExactDedup-x64</tt>
+
:<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> is required for <tt>StrFmt-x64</tt>
 
<br>
 
<br>
  

Latest revision as of 21:18, 25 May 2020

Abstract
Author StainlessS
Version v1.00
Download StrFmt_25_26_x86_x64_dll_v1.00_20190114.zip
Category Support filters
License GPLv2
Discussion Doom9 Forum


Contents

[edit] Description

Simple plugin to produce formatted string, and additional function to string replace with another string.

[edit] Requirements


*** vcredist_x86.exe is required for StrFmt-x86
*** vcredist_x64.exe is required for StrFmt-x64


[edit] Syntax and Parameters

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.


[edit] Examples

TODO

[edit] Changelog

 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. 


[edit] Archived Downloads

Version Download Mirror
v1.00 StrFmt_25_26_x86_x64_dll_v1.00_20190114.zip StrFmt_25&26_x86_x64_dll_v1.00_20190114.zip


[edit] External Links




Back to External Filters

Personal tools