transforming String and getting the Specified Value Java (Android) -
i new in android development , want write function have written ios
in swift, if can me great :
i want convert string
string1 = "guardians of galaxy(g.t.g)"
into
string2 = "gtg"
all want value inside brackets , remove .
, if there's space within them
here's how in swift maybe it'll understand
if spacelessfullform = "catch me if can"
let spacelessfullform = fullform.condensedwhitespace let delimiters: nscharacterset = nscharacterset(charactersinstring: "()") var splitstring: [anyobject] = spacelessfullform.componentsseparatedbycharactersinset(delimiters) let substring: string = splitstring[1] as! string print(substring) let dotlessstring = substring.stringbyreplacingoccurrencesofstring(".", withstring: "") let uppercasefirstcharcters = dotlessstring.stringbyreplacingoccurrencesofstring(" ", withstring: "")
then uppercasefirstcharcters = "cmiuc"
try way..
string kek = "guardians of galaxy(g.t .g . v)"; int find = kek.indexof("(") + 1; int lind = kek.indexof(")"); string kek1 = kek.substring(find, lind); string kek2 = kek1.replace(".", "").replace(" ", ""); toast.maketext(getapplicationcontext(), kek2, toast.length_short) .show();
result : gtgv
Comments
Post a Comment