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