java - String[] strings = TextUtils.split(line, "-"); -


i experimenting dictionary sample app comes android eclipse plugin. i'm trying create directory of local business'. issue section of code.

try {     string line;      while((line = reader.readline()) != null) {         string[] strings = textutils.split(line, "-");         if (strings.length < 2) continue;             addword(strings[0].trim(), strings[1].trim());         }     } {         reader.close();     }     mloaded = true; } 

this code allows me split line 2 strings first being before the hyphen , second string after hyphen. trying use similar code want break down 3 strings apposed 2

thanks help

split() method split string depending upon expression want split with

for example: in case want split using "-"

string "abcd-xyz" split "abcd" , "xyz" string "abcd-xyz-1234" split "abcd" , "xyz" , "1234"

it depends upon string passing in.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -