java
1//変数updatecommentですと、printを使っても、下記のように改行されてしまいます。 2 System.out.print("comment:"+updatecomment+":"); 3 4I/System.out: comment: いえーい 5I/System.out: : 6 7
//なぜ、改行が混じったのかはわかりませんが、このような過程の中で、問題は発生しました。やろうとしてたことを、簡単にいうと、ListViewをCLickして取得したitemを、分別して、データベースのwhere句に指定して、selectしようとしてました。そして、無事、selectまでできました。
java
1 2 //一方違う変数の、usernameですと、printlnを使っても下記のように改行されることはありませんでした。 3System.out.println(updateusername+":"+username+":"); 4System.out.println(updateusername+":"+username); 5 6I/System.out: sato:sato: 7I/System.out: sato:sato
java
1//また、変数updatecommentのみを出力するとこのようになります。 2System.out.print(updatecomment); 3 4I/System.out: いえーい 5
javaで、このように改行されて表示されてしまいます。何が原因なのでしょうか?
教えていただけないでしょうか?
java
1String item =(String)listView.getItemAtPosition(position); 2String dataand = item.replaceFirst(" ",":"); 3 System.out.println("dataand "+dataand); 4 5 //最初のスペース(username)までの間を取得して、dataにセット 6 updatedata=dataand.substring(0, dataand.indexOf(" ")); 7 System.out.println("data "+updatedata); 8 9 //usernameの判定 10 //" "を削除したdataandから1つめの" "から後ろを取り出す 11 String usernameand =dataand.substring(dataand.indexOf(" ")+1); 12 13 System.out.println("usernameand "+usernameand); 14 //そして、" "より前を取り出す 15 updatetouchusername=usernameand.substring(0, usernameand.indexOf(" ")); 16 System.out.println(updatetouchusername+" touchusername"); 17 18 19 //comment 20 //usernameandの" "より後ろを取り出す 21 updatecomment=usernameand.substring(usernameand.indexOf(" ")+1); 22 //" "を削除した 23 updatecomment = updatecomment.replaceFirst(" ",""); 24 // 改行を削除して解決 25 updatecomment = updatecomment.replaceFirst("\\n",""); 26 27 28 29 05-10 19:27:30.122 30834-30834/com.example.sample.near I/System.out: 5/10 1:19 endo いえーい 30 05-10 19:27:30.122 30834-30834/com.example.sample.near I/System.out: 1 31 05-10 19:27:30.122 30834-30834/com.example.sample.near I/System.out: 5/10 1 1.5 32 05-10 19:27:30.122 30834-30834/com.example.sample.near I/System.out: getusedesdata2 null 33 05-10 19:27:30.122 30834-30834/com.example.sample.near I/System.out: timeage null 34 05-10 19:27:30.122 30834-30834/com.example.sample.near I/System.out: 3 35 05-10 19:27:30.122 30834-30834/com.example.sample.near I/System.out: 4 36 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: dataand 5/10:1:19 endo いえーい 37 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: data 5/10:1:19 38 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: usernameand endo いえーい 39 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: endo touchusername 40 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: あああいえーい 41 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: いえーい 42 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: comment:いえーい: 43 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: endoあ:endo 44 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: endo:endo: 45 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: endo:endo 46 05-10 19:27:30.132 30834-30834/com.example.sample.near I/System.out: 5
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/10 10:50
2017/05/10 11:02
2017/05/11 03:32
2017/05/11 03:52
2017/05/11 04:27