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 ]

Split and join

See also std.array.

(1) split(), join()
def main():
    s1 = "aa;bb;cc;dd"
    parts = s1.split(";")
    print(parts)  # ['aa', 'bb', 'cc', 'dd']

    s2 = "   one   \t    two  \n     "
    words = s2.split()
    print(words)  # ['one', 'two']

    pieces = ["aa", "bb", "cc"]
    back = "|".join(pieces)
    print(back)  # aa|bb|cc
    print("".join(pieces))  # aabbcc
import std.stdio;
import std.array; // split(), join()

void main()
{
    string s1 = "aa;bb;cc;dd";
    auto parts = s1.split(";"); // ["aa", "bb", "cc", "dd"]
    writeln(parts);

    string s2 = "   one   \t    two  \n     ";
    auto words = s2.split();
    writeln(words); // ["one", "two"]

    auto pieces = ["aa", "bb", "cc"];
    string back = pieces.join("|");
    writeln(back); // aa|bb|cc
    writeln(pieces.join()); // aabbcc
}
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 28, 13:38