D Programming Language
Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

# std.metastrings

Deprecated. It will be removed in March 2014. Please use std.string.format, std.conv.to, or std.conv.parse instead of these templates (which one would depend on which template is being replaced.) They now work in CTFE, and these templates are very inefficient.

Templates with which to do compile-time manipulation of strings.

License:
Boost License 1.0.

Authors:
Walter Bright, Don Clugston

Source:
std/metastrings.d

template Format(A...)
  Deprecated. Please use std.string.format instead. It now works in CTFE, and this template is very inefficient.

  Formats constants into a string at compile time. Analogous to std.string.format.

  Parameters:
  A = tuple of constants, which can be strings, characters, or integral values.

  Formats:
  The formats supported are %s for strings, and %% for the % character.

  Example:

      import std.metastrings;
      import std.stdio;

      void main()
      {
        string s = Format!("Arg %s = %s", "foo", 27);
        writefln(s); // "Arg foo = 27"
      }

template toStringNow(ulong v)
template toStringNow(long v)
template toStringNow(uint U)
template toStringNow(int I)
template toStringNow(bool B)
template toStringNow(string S)
template toStringNow(char C)
  Deprecated. Please use std.conv.format instead. It now works in CTFE, and this template is very inefficient.

  Convert constant argument to a string.

template parseUinteger(const(char)[] s)
  Deprecated. Please use std.conv.parse instead. It now works in CTFE, and this template is very inefficient.

  Parse unsigned integer literal from the start of string s.

  Returns:
  .value = the integer literal as a string, .rest = the string following the integer literal

  Otherwise:
  .value = null, .rest = s

template parseInteger(const(char)[] s)
  Deprecated. Please use std.conv.parse instead. It now works in CTFE, and this template is very inefficient.

  Parse integer literal optionally preceded by '-' from the start of string s.

  Returns:
  .value = the integer literal as a string, .rest = the string following the integer literal

  Otherwise:
  .value = null, .rest = s

Copyright Digital Mars 2007 - 2013. | Page generated by Ddoc.