I am trying to convert a text, as an example "aaaa" into a set of numbers as defined in a list of replacement rules, for example letterstonum . letterstonum takes in letters a to z and returns the respective number from 1 to 26.
it works fine when tried with individual letters for instance:
Replace[a, letterstonum]
1 was returned
What I want to do is the same for a set of characters, for instance aaaa or abjdfjs .
I tried the following:
ReplaceAll[Characters["aaaaa"], letterstonum]
but the only return I got was {"a", "a", "a", "a", "a"}
which is the same I get for evaluating[Characters["aaaaa"]
My desired output in this case, would be 11111 or {1,1,1,1,1}
Is there something I'm doing wrong or missing?
Any help would be much appreciated
here's letterstonum :
letterstonum = {a -> 1, b -> 2, c -> 3, d -> 4, e -> 5, f -> 6,
g -> 7, h -> 8, i -> 9, j -> 10, k -> 11, l -> 12, m -> 13, n -> 14,
o -> 15, p -> 16, q -> 17, r -> 18, s -> 19, t -> 20, u -> 21,
v -> 22, w -> 23, x -> 24, y -> 25, z -> 26}
letterstonum
defined. Please post them. $\endgroup$ – Jack LaVigne Oct 13 '15 at 0:26