Closed hachi8833 closed 7 years ago
String#strip
, it need to handle the case such that:"\n\t Hello World\t \r\n".strip # => "Hello World"
Actually, I met the same issue when trying to implement String#strip
;-)
Well, I suppose we should also change string
type in Golang to rune
type.
I'll let @Maxwell-Alexius work on this first.
@st0012 @hachi8833 I'm not sure whether to also convert string
type to rune
type in initStringObject
? What are your opinions? (If this conversion is needed, then it should open another PR to implement it.)
I'm not very familiar with rune
type, need to spend some to do some research.
Me, too. There's a lot to learn, then leave this issue for a moment. (I'll keep on implementing other string api in #184 )
@hachi8833 I think @Maxwell-Alexius already fixed this, can you help verify?
Confirmed \n
\t
works now!
I close the issue.
Special characters with backslash such as
\n
\r
\t
\v
are not treated. Looks like string literals are actually just a byte stream.