-
Notifications
You must be signed in to change notification settings - Fork 11
Features: String Formatting
Rudy Huyn edited this page Aug 1, 2019
·
9 revisions
ReswPlus can generate strongly typed methods to format your strings.
Simply add the tag #Format[...]
in the comment column of your resw file and ReswPlus will automatically generate a method with strongly typed parameters.
The identifier of the types supported are inspired by MIDL 3.0:
identifier | C# Type | VB Type | C++/CX Type | C++/WinRT Type |
---|---|---|---|---|
Byte | byte | Byte | char | char |
Int/Int32 | int | Integer | int | int |
UInt/Uint32 | uint | UInteger | unsigned int | unsigned int |
Long/Int64 | long | Long | long | long |
ULong/UInt64 | ulong | ULong | unsigned long | unsigned long |
String | string | String | Platform::String^ | hstring |
Double | double | Double | double | double |
Char | char | Char | wchar_t | wchar_t |
Decimal | decimal | Decimal | long double | long double |
Object | Object | object | Platform::Object^ | IStringable |
Example:
Key | Value | Comment |
---|---|---|
ForecastAnnouncement | The temperature in {2} is {0}°F ({1}°C) | #Format[Int32, Int32, String] |
To use " in your literal strings, you need to escape it and write \"
instead.
Example: #Format["Welcome to my \"Home\"!"]
All other special characters used by ReswPlus (#, [, ], ,) don't need to be escaped.
Example: #Format["Hello [You]", "Welcome, come in!", "#hashtag"]