Creating/setting a var/Value from a single character

Currently I have a monstrosity like :
StringArray alphas{ “a”,“b”,“c”,“d”,“e”,“f”,“g”,“h”,“i”,“j”,“k”,“l”,“m”,“n” };


(Where “parameter” is a Value.)

I wonder if there’s any other way to do this? (Basically in this situation I need to map integers starting from 0 to alphabet characters that are used to initialize a Juce Value as a String.)

I have two ideas:

String alphas = "abcdefghijklmnopqrstuvwxyz";
thing->parameter.setValue (alphas.substring (i, i+1));

or b)

thing->parameter.setValue (String::charToString (i + 97));  // 97 = ascii ('a'), for upper case use 65

Hope that helps…

Thanks, I had missed String::charToString… (So many functions in the String class :stuck_out_tongue: )

Indeed… lot’s in there :slight_smile: