Skip to main content Link Search Menu Expand Document (external link)

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

<p></p>

Data:

doc.Params["model"] = new {
    text = "hello world"
};

Output:

<p>HELLO WORLD</p>

Headers and Titles

<h1></h1>

Data:

doc.Params["model"] = new {
    title = "Important Notice"
};

Output:

<h1>IMPORTANT NOTICE</h1>

Product Codes

<p>SKU: </p>

Data:

doc.Params["model"] = new {
    sku = "wdg-12345-a"
};

Output:

<p>SKU: WDG-12345-A</p>

Capitalize First Letter

<p></p>

Data:

doc.Params["model"] = new {
    name = "john doe"
};

Output:

<p>John doe</p>

Emphasis


  <div class="alert">
    <strong></strong>: 
  </div>

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()

See Also