2017-01-27 00:45:30 +03:00
|
|
|
# String operations which don't require allocation
|
|
|
|
import micropython
|
|
|
|
|
|
|
|
micropython.heap_lock()
|
|
|
|
|
2017-03-22 22:17:52 +03:00
|
|
|
# Concatenating empty string returns original string
|
2017-01-27 00:45:30 +03:00
|
|
|
b"" + b""
|
|
|
|
b"" + b"1"
|
|
|
|
b"2" + b""
|
|
|
|
|
|
|
|
"" + ""
|
|
|
|
"" + "1"
|
|
|
|
"2" + ""
|
|
|
|
|
2017-03-22 22:17:52 +03:00
|
|
|
# If no replacements done, returns original string
|
|
|
|
"foo".replace(",", "_")
|
|
|
|
|
2017-01-27 00:45:30 +03:00
|
|
|
micropython.heap_unlock()
|