Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
UppHub
Status & Roadmap
FAQ
Authors & License
Forums
Funding U++
Search on this site











SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo

Format

 

Formatting Strings

 

Format("%d, %s", 123, "TEXT") = 123, TEXT

Format("%2:s, %1:d", 123, "TEXT") = TEXT, 123

Format("%010d", 123) = 0000000123

Format("%0*d", 11, 123) = 00000000123

Format("|%20<d|", 123) = |123                 |

Format("|%20>d|", 123) = |                 123|

Format("|%20=d|", 123) = |        123         |

Format("%d`pt", 123) = 123pt

Format("%[empty]~d, %[empty]~d", 123, Null) = 123, empty

Format("%`", 123) = 123

Format("%c", 65) = A

Format("%d", 123) = 123

Format("%i", 123) = 123

Format("%o", 123) = 173

Format("%x", 123) = 7b

Format("%X", 123) = 7B

Format("%e", 1.23) = 1.230000e+000

Format("%E", 1.23) = 1.230000E+000

Format("%f", 1.23) = 1.230000

Format("%g", 1.23) = 1.23

Format("%G", 1.23) = 1.23

Format("%n", 1.23) = 1.23

Format("%n", 1.23) = 1.23

Format("%ne", 1.23) = 1.23

Format("%nf", 1.23e30) = 1230000000000000000000000000000

Format("%nl", 1.23) = 1,23

Format("%v", 1.23) = 1.23

Format("%ve", 1.23) = 1.23

Format("%vf", 1.23e30) = 1230000000000000000000000000000

Format("%vl", 1.23) = 1,23

Format("%[1:one;2:two;3:three;another]s", 2) = two

Format("%[1:one;2:two;3:three;another]s", 20) = another

Format("%[3%1:one;2:two;3:three;another]s", 20) = two

Format("%month", 6) = june

Format("%Month", 6) = June

Format("%MONTH", 6) = JUNE

Format("%mon", 6) = jun

Format("%Mon", 6) = Jun

Format("%MON", 6) = JUN

Format("%day", 6) = saturday

Format("%Day", 6) = Saturday

Format("%DAY", 6) = SATURDAY

Format("%dy", 6) = sa

Format("%Dy", 6) = Sa

Format("%DY", 6) = SA

Format("%tw", 0) = 12

Format("%tw", 5) = 5

Format("%tw", 15) = 3

Format("%0tw", 15) = 03

Format("%a", 1) = a

Format("%a", 123) = es

Format("%A", 1) = A

Format("%A", 123) = ES

Format("%r", 8) = viii

Format("%R", 1231) = MCCXXXI

Format("%`", GetSysDate()) = 12/28/2006

Format("%`", GetSysTime()) = 12/28/2006 18:11:41

Format("%`", "text") = text

Format("%`", GetSysDate()) = 28.12.2006

 

 

 

 

Format.cpp

 

#include <Core/Core.h>

 

using namespace Upp;

 

CONSOLE_APP_MAIN

{

    SetLanguage(LNG_ENGLISH);

 

    DUMP(Format("%d, %s", 123, "TEXT"));

    DUMP(Format("%2:s, %1:d", 123, "TEXT"));

    DUMP(Format("%010d", 123));

    DUMP(Format("%0*d", 11, 123));

    DUMP(Format("|%20<d|", 123));

    DUMP(Format("|%20>d|", 123));

    DUMP(Format("|%20=d|", 123));

    DUMP(Format("%d`pt", 123));

    DUMP(Format("%[empty]~d, %[empty]~d", 123, Null));

 

    DUMP(Format("%`", 123));

 

    DUMP(Format("%c", 65));

    DUMP(Format("%d", 123));

    DUMP(Format("%i", 123));

    DUMP(Format("%o", 123));

    DUMP(Format("%x", 123));

    DUMP(Format("%X", 123));

 

    DUMP(Format("%e", 1234567.89));

    DUMP(Format("%E", 1234567.89));

    DUMP(Format("%f", 1234567.89));

    DUMP(Format("%g", 1234567.89));

    DUMP(Format("%G", 1234567.89));

 

    DUMP(Format("%m", 1234567.89));

    DUMP(Format("%M", 1234567.89));

    DUMP(Format("%,m", 1234567.89));

    DUMP(Format("%+m", 1234567.89));

    DUMP(Format("% m", 1234567.89));

    DUMP(Format("%.10m", 1234567.89));

    DUMP(Format("%.10!m", 1234567.89));

    DUMP(Format("%.6m", 1234567.89));

    DUMP(Format("%.7m", 1234567.89));

    DUMP(Format("%.7#m", 1234567));

    DUMP(Format("%m", -0.0));

    DUMP(Format("%_m", -0.0));

    DUMP(Format("%m", 1e9));

    DUMP(Format("%^m", 1e9));

    DUMP(Format("%&m", 1e9));

    DUMP(Format("%&^m", 1e9));

    DUMP(Format("%m", log(-1)));

    DUMP(Format("%?m", log(-1)));

    DUMP(Format("%.5mf", 1234567.89));

    DUMP(Format("%.2me", 1234567.89));

    DUMP(Format("%.2mE", 1234567.89));

 

    DUMP(Format("%[1:one;2:two;3:three;another]s", 2));

    DUMP(Format("%[1:one;2:two;3:three;another]s", 20));

    DUMP(Format("%[3%1:one;2:two;3:three;another]s", 20));

 

    DUMP(Format("%month", 6));

    DUMP(Format(LNG_('C','S','C','Z'), "%month", 6));

    DUMP(Format("%Month", 6));

    DUMP(Format("%MONTH", 6));

    DUMP(Format("%mon", 6));

    DUMP(Format("%Mon", 6));

    DUMP(Format("%MON", 6));

    DUMP(Format("%day", 6));

    DUMP(Format("%Day", 6));

    DUMP(Format("%DAY", 6));

    DUMP(Format("%dy", 6));

    DUMP(Format("%Dy", 6));

    DUMP(Format("%DY", 6));

    DUMP(Format("%tw", 0));

    DUMP(Format("%tw", 5));

    DUMP(Format("%tw", 15));

    DUMP(Format("%0tw", 15));

 

    DUMP(Format("%a", 1));

    DUMP(Format("%a", 123));

    DUMP(Format("%A", 1));

    DUMP(Format("%A", 123));

    DUMP(Format("%r", 8));

    DUMP(Format("%R", 1231));

 

    DUMP(Format("%`", GetSysDate()));

    DUMP(Format("%`", GetSysTime()));

    DUMP(Format("%`", "text"));

 

    SetLanguage("cs-cz");

    DUMP(Format("%`", GetSysDate()));

}

 

 

 

 

Do you want to contribute?