Breadcrumbs

String

String

Features

All character strings are in Unicode.

  • Escape characters
    \n: New line
    \t: Tab
    \r: Carrage return
    \0: Null string
    \\: back slash(\) in string
    \’: single quote mark in string
    \": double quote mark in string

  • String concatenation: "py"+ "tyon" → "python"

  • String repeatition: "py"* 3 → "pypypy"

  • String indexing: "python" [0] → "p"

  • String slicing: "python" [1:4] → "yth"

Example

Python
"string1"
'string2'

tp_log("st"+"ring")
	#expected result: string
tp_log("str"* 3)
	#expected result: strstrstr
tp_log("line1\nline2")
	#expected result: line1
	# line2
tp_log("\"string\"")
	#expected result: "string"
tp_log("str"[0])
	#expected result: s
tp_log("string"[1:3])
	#expected result: tr


+, *

Example

Python
"Doosan"+ "Robotics" → "DoosanRobotics"
"Doo"* 3 → "DooDooDoo"


Indexing & slicing

Example

Python
" Doosan" [0] → "D"
" Doosan" [1:4] → "oos"