Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

clojure
communitycreator

What is the string upper-case method in Clojure?

Chinweuba Elijah Azubuike

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Strings in Clojure

Strings in Clojure are a sequence of characters enclosed in double quotation marks ("").

String upper-case

The string upper-case method in Clojure converts all characters of a string to the upper case.

Syntax

(upper-case s)

Parameter

The string upper-case method accepts one parameter, which is the string s.

Return value

This method returns a string with all characters in the upper case.

Let’s see an example.

Example

(ns clojure.examples.hello
(:gen-class))
(defn EXAMPLE []
(println (clojure.string/upper-case "Educative"))
(println (clojure.string/upper-case "educative")))
(EXAMPLE)
String upper-case in Clojure

Explanation

  • Line 3: We define a function EXAMPLE.

  • Line 4: We convert the string Educative to EDUCATIVE using the string upper-case method. We nest clojure.string using the dot notation. This shows that the upper-case method is a core string method of Clojure.

  • Line 5: We convert educative to EDUCATIVE using the same method as in line 4.

  • Line 6: We call the EXAMPLE function.

RELATED TAGS

clojure
communitycreator

CONTRIBUTOR

Chinweuba Elijah Azubuike

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring