How to convert String to ASCII using Scala -


i convert every single word decimal ascii.
for example "resep" :
r = 82,
e = 69,
s = 83,
e = 69,
p = 80

my code is:

val list_keyword = list("resep", "daging sapi", "daging kambing")  val rubah_byte = list_keyword.map(_.split(",")).map {   baris =>     (       baris(0).getbytes     ) } 

and then, stuck , don't know supposed next.

scala> "resep".map(_.tobyte) res1: scala.collection.immutable.indexedseq[byte] = vector(82, 69, 83, 69, 80)  scala> "resep".map(x => x -> x.tobyte) res2: scala.collection.immutable.indexedseq[(char, byte)] = vector((r,82), (e,69), (s,83), (e,69), (p,80))  scala> val list_keyword = list("resep",      | "daging sapi",      | "daging kambing") list_keyword: list[string] = list(resep, daging sapi, daging kambing)  scala> list_keyword.map(_.map(_.tobyte)) res3: list[scala.collection.immutable.indexedseq[byte]] = list(vector(82, 69, 83, 69, 80), vector(68, 65, 71, 73, 78, 71, 32, 83, 65, 80, 73), vector(68, 65, 71, 73, 78, 71, 32, 75, 65, 77, 66, 73, 78, 71))  scala> list_keyword.map(_.map(x => x -> x.tobyte)) res4: list[scala.collection.immutable.indexedseq[(char, byte)]] = list(vector((r,82), (e,69), (s,83), (e,69), (p,80)), vector((d,68), (a,65), (g,71), (i,73), (n,78), (g,71), ( ,32), (s,83), (a,65), (p,80), (i,73)), vector((d,68), (a,65), (g,71), (i,73), (n,78), (g,71), ( ,32), (k,75), (a,65), (m,77), (b,66), (i,73), (n,78), (g,71))) 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -