toUpper() : Convert to Uppercase
On this page
Summary
Convert a string to uppercase letters.
Signature
toUpper(str)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
str |
String | Yes | The string to convert |
Returns
Type: String
The string converted to uppercase.
Examples
Basic Uppercase
Data:
doc.Params["model"] = new {
text = "hello world"
};
Output:
<p>HELLO WORLD</p>
Headers and Titles
Data:
doc.Params["model"] = new {
title = "Important Notice"
};
Output:
<h1>IMPORTANT NOTICE</h1>
Product Codes
Data:
doc.Params["model"] = new {
sku = "wdg-12345-a"
};
Output:
<p>SKU: WDG-12345-A</p>
Capitalize First Letter
Data:
doc.Params["model"] = new {
name = "john doe"
};
Output:
<p>John doe</p>
Emphasis
Data:
doc.Params["model"] = new {
alerts = new[] {
new { level = "warning", message = "Low disk space" },
new { level = "error", message = "Connection failed" }
}
};
Output:
<div class="alert">
<strong>WARNING</strong>: Low disk space
</div>
<div class="alert">
<strong>ERROR</strong>: Connection failed
</div>
Notes
- Converts all lowercase letters to uppercase
- Leaves numbers and special characters unchanged
- Culture-dependent (uses current culture)
- Useful for headings and emphasis
- Does not modify the original value
- For lowercase, use
toLower()