趣味のandroid開発中のお話
やりたいこと
string(文字列)中のホワイトスペースを削除
最初こうした
"s t r i n g".trim()
帰ってくるのは
"s t r i n g"・・・・
あれ・・・?
数分悩む
正しくはこちら
"s t r i n g".replace(Regex(" "),"")
寝ぼけているのか自分は><
一番最初に"Returns a sub sequence of this char sequence having leading and trailing characters matching the predicateremoved."
と書かれているじゃないか。
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim.html
こんなくだらないことで時間を無駄にしたことを反省。恥ずかしいが書き留めておこう。