Assign Characters to a substring
in
Programming Questions
•
1 year ago
Hi, I should want to assign a letter to a substring in a String,
for example, with two string:
The full code I use is:
Thank you so much for answering...
for example, with two string:
- String KeyList = "abcdefghilmnopqrstuvzABCDEFGHILMNOPQRSTUVZ";
- String[] RecordList = { "example", "B", "C",};
- RecordList[0].substring(0,1) = KeyList.charAt(x);
The full code I use is:
- PFont AndaleMono;
void setup() {
size(800, 600);
smooth();
stroke(200);
background(255);
AndaleMono = loadFont("AndaleMono-11.vlw");
fill(230);
rect(50,35,200,20);
}
void draw() {
smooth();
}
String KeyList = "abcdefghilmnopqrstuvzABCDEFGHILMNOPQRSTUVZ";
String[] RecordList = {
"example",
"B",
"C",
};
void keyPressed() {
for (int x = 0; x < 42; x++) {
if (key == KeyList.charAt(x)) {
textFont(AndaleMono,11);
fill(50);
textAlign(LEFT);
text(KeyList.charAt(x),52,50);
RecordList[0].substring(0,1) = KeyList.charAt(x);
} else {
}
}
}
Thank you so much for answering...
1