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