class WindowsCmdStringTemplate extends StringTemplate
A string template that uses the cmd Windows.exe syntax %varname%
for
variable references. A variable's name may consist of alphanumerics and
underscores. To include a literal "%" in a string, use two in a row
("%%").
- Alphabetic
- By Inheritance
- WindowsCmdStringTemplate
- StringTemplate
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
WindowsCmdStringTemplate(resolveVar: (String) ⇒ Option[String], safe: Boolean)
Alternate constructor that uses a variable name pattern that permits variable names with alphanumerics and underscore.
Alternate constructor that uses a variable name pattern that permits variable names with alphanumerics and underscore.
- resolveVar
A function that takes a variable name as a parameter and returns an
Option[String]
value for the variable, orNone
if there is no value (Map[String, String].get()
, for instance).- safe
true
for a "safe" template that just substitutes a blank string for an unknown variable,false
for one that throws an exception.
-
new
WindowsCmdStringTemplate(resolveVar: (String) ⇒ Option[String], namePattern: String, safe: Boolean)
- resolveVar
A function that takes a variable name as a parameter and returns an
Option[String]
value for the variable, orNone
if there is no value (Map[String, String].get()
, for instance).- namePattern
Regular expression pattern to match a variable name, as a string (not a Regex). For example: "[a-zA-Z0-9_]+"
- safe
true
for a "safe" template that just substitutes a blank string for an unknown variable,false
for one that throws an exception.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
findVariableReference(s: String): Option[Variable]
Parse the location of the first variable in string.
Parse the location of the first variable in string.
- s
the string
- returns
an
Option[Variable]
, specifying the variable's location; orNone
if not found
- Attributes
- protected
- Definition Classes
- WindowsCmdStringTemplate → StringTemplate
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
val
resolveVar: (String) ⇒ Option[String]
- Definition Classes
- StringTemplate
-
val
safe: Boolean
- Definition Classes
- StringTemplate
-
def
sub(s: String): Try[String]
Replace all variable references in the given string.
Replace all variable references in the given string. Variable references are recognized per the regular expression passed to the constructor. If a referenced variable is not found in the resolver, this method either:
- throws a
VariableNotFoundException
(ifsafe
isfalse
), or - substitutes an empty string (ifsafe
istrue
)Recursive references are supported (but beware of infinite recursion).
- s
the string in which to replace variable references
- returns
Right(substitutedValue)
orLeft(error)
- Definition Classes
- WindowsCmdStringTemplate → StringTemplate
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )