Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

* Programming 1 (BI)
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* 2024/25/2
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

Multiline and raw string

See also std.string.

Multiline string

(1) multiline string
TEXT = """
D is a general-purpose systems programming language
with a C-like syntax that compiles to native code.
It is statically typed and supports both automatic
(garbage collected) and manual memory management.
"""
.strip()


def main():
    print(TEXT)
import std.stdio;
import std.string;  // strip()

const string TEXT = "
D is a general-purpose systems programming language
with a C-like syntax that compiles to native code.
It is statically typed and supports both automatic
(garbage collected) and manual memory management.
"
.strip();

void main()
{
    writeln(TEXT);
}

It would also work:

enum TEXT = "
...
"
.strip();

Output:

D is a general-purpose systems programming language
with a C-like syntax that compiles to native code.
It is statically typed and supports both automatic
(garbage collected) and manual memory management.

Raw string

(2) raw string
def main():
    path = r"C:\utils\cpc.exe"
    print(path)
import std.stdio;

void main()
{
    string path = r"C:\utils\cpc.exe";
    writeln(path);
}

Output:

C:\utils\cpc.exe

Quoted string

(3) quoted string
import std.stdio;

void main()
{
    string s1 = "She said: \"Get out!\"";
    string s2 = q{She said: "Get out!"};
    string s3 = `She said: "Get out!"`; // this is a raw string

    writeln(s1);
    writeln(s2);
    writeln(s3);
}

Output:

She said: "Get out!"
She said: "Get out!"
She said: "Get out!"
Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2025 June 27, 12:24