পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Friday, January 27, 2017

Clojure - Strings

A String literal is constructed in Clojure by enclosing the string text in quotations. Strings in Clojure need to be constructed using the double quotation marks such as “Hello World”.

Example

Following is an example of the usage of strings in Clojure.
(ns clojure.examples.hello
   (:gen-class))
(defn hello-world []
   (println "Hello World")
   (println "This is a demo application"))
(hello-world)

Output

The above program produces the following output.
Hello World
This is a demo application

Basic String Operations

Clojure has a number of operations that can be performed on strings. Following are the operations.
S.No. String Operations & Description
1 str The concatenation of strings can be done by the simple str function.
2 format The formatting of strings can be done by the simple format function. The format function formats a string using java.lang.String.format.
3 count Returns true if number is less than zero, else false.
4 subs Returns the substring of ‘s’ beginning at start inclusive, and ending at end (defaults to length of string), exclusive.
5 compare Returns a negative number, zero, or a positive number when ‘x’ is logically 'less than', 'equal to', or 'greater than' ‘y’.
6 lower-case Converts string to all lower-case.
7 upper-case Converts string to all upper-case.
8 join Returns a string of all elements in collection, as returned by (seq collection), separated by an optional separator.
9 split Splits string on a regular expression.
10 split-lines Split strings is based on the escape characters \n or \r\n.
11 reverse Reverses the characters in a string.
12 replace Replaces all instance of a match in a string with the replacement string.
13 trim Removes whitespace from both ends of the string.
14 triml Removes whitespace from the left hand side of the string.
15 trimr Removes whitespace from the right hand side of the string.

No comments:

Post a Comment