开发者

Android query to extract first word from a field

开发者 https://www.devze.com 2023-04-06 12:06 出处:网络
So I\'ve been dragging with this on开发者_如何学运维e for some time now and simply can\'t find the solutions

So I've been dragging with this on开发者_如何学运维e for some time now and simply can't find the solutions

Let's say I have a table called NAME with values like John Doe Jane Doe etc.

I just want to pull the first word.... so everything after the first space ' ' will not show I'm pulling the data into a Cursor as it's over 2000 records

Any thoughts on a raw query that will do such a thing? Thanks in advance Yeshai


You just get the string from db as a string and use something like

String[] strs = dbString.split(" ");

str[0] should be what you need.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号