如何获取微调器的部分值?
我的意思是我的微调器显示:
“34 | Stress Shot #01”,通过 php 从 mysql 获取 json 数据。
在 Activity 中,我想发送一些数据来更新表,并且从微调器中我只需要“34”而不是字符串的其余部分。 有可能实现吗?我已经搜索过,但没有真正找到任何东西
最佳答案
假设您的数据始终是要显示的数字,后跟“|”。
String yourString = "34 | Stress Shot #01";
String[] parts = string.split("\\|"); // Splitting your string with character "|". SO you will get "34 " and " Stress Shot #01"
String iNeeded = parts[0];// You need the first part only
关于php - Android + Json通过php将部分spinner值插入mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31643538/