KamielDev :
This question concerns Processing code.
I know that you can substitute a variable in a string by doing the following:
String words = "these words";
text("I want to substitute " + words + "!", textX, textY);
However, I was wondering if there's a way to do it like I am used to doing this in Python:
words = "these words";
print('I want to substitute %s!' % words);
I find this much more readable as the strings aren't as cut up with all types of operators and variables.
Andronicus :
You can use String.format
for that:
String formattedString = String.format("I want to substitute %s!", words);
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=307151&siteId=1