<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with join() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=join%28%29</link>
      <pubDate>Sun, 08 Aug 2021 20:12:22 +0000</pubDate>
         <description>Tagged with join() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedjoin%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>How to join() using more dimensional arrays?</title>
      <link>https://forum.processing.org/two/discussion/27940/how-to-join-using-more-dimensional-arrays</link>
      <pubDate>Tue, 08 May 2018 13:40:39 +0000</pubDate>
      <dc:creator>2000mater</dc:creator>
      <guid isPermaLink="false">27940@/two/discussions</guid>
      <description><![CDATA[<p>I've made some pretty nice 2d  arrays, but I found some problems with it while trying to save the number pattern to text. I either got nothing or an error, or a messy text file with numbers and nulls mixed up in it.
I think the most problematic thing is the join() command, and the fact that I can't tell it which array slot i'm interested in while joining them. All in all, I'm kinda stuck and this path might not be the right one, but here it is what I was trying to do (help is very appreciated):</p>

<pre><code>    short i=1;short j=0;

    for(i=1 ;i&lt;24; i++) {
      for(j=0 ;j&lt;35; j++) {
        pieceData[i][j] = str(patternXY[i][j]);
      }
      mainData[i] = join(pieceData[i],",");
    }

    saveStrings("data/text"+001+".txt" , mainData);
</code></pre>
]]></description>
   </item>
   <item>
      <title>Array index and item as drawn text</title>
      <link>https://forum.processing.org/two/discussion/26675/array-index-and-item-as-drawn-text</link>
      <pubDate>Tue, 06 Mar 2018 15:50:50 +0000</pubDate>
      <dc:creator>Leo_Aguiar</dc:creator>
      <guid isPermaLink="false">26675@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys,</p>

<p>Is there a way to have an array's indexes and items be drawn as text? I couldn't find anything specific on this and I'm a beginner to intermediate coder.</p>

<p>I've tried something like the following in the draw function: text("myArray indexes and items:" + myArray_name, 25, 25);</p>

<p>But the text that is drawn isn't anything I can understand. It seems like it's a hexadecimal number and not the familiar [0] item0 , [1] item1, [2] item2, [n] itemn format.</p>

<p>Do I need to do some sort of conversion where the array is transformed in to a String before it goes into the text()?</p>

<p>Thanks for the help!</p>
]]></description>
   </item>
   <item>
      <title>textSize (variable) using dictionary values making word cloud</title>
      <link>https://forum.processing.org/two/discussion/25375/textsize-variable-using-dictionary-values-making-word-cloud</link>
      <pubDate>Mon, 04 Dec 2017 15:29:54 +0000</pubDate>
      <dc:creator>111aei</dc:creator>
      <guid isPermaLink="false">25375@/two/discussions</guid>
      <description><![CDATA[<p>Hi I have a quick question about textSize</p>

<p>I have a dictionary, that has values such as this  {'birthday': 6, 'think': 5, 'cookie': 15, 'happy': 5, 'ice': 5, 'cream': 5, 'nom': 25, 'boy': 6}</p>

<p>Since I'm making a wordCloud, certain words have to be bigger than the other, and I was going to take the value and times it by three so it would be something like this</p>

<p>pop_words =  {'birthday': 18, 'think': 15, 'cookie': 45, 'happy': 15, 'ice': 15, 'cream': 15, 'nom': 75, 'boy': 18}</p>

<p>I wanted to use those numbers as the textSize but I don't quite know how to do that.</p>

<p>I thought about putting it in a for loop but that doesn't seem to work for me, and I'm personally stuck</p>

<pre><code>#Text data 
for value in pop_words:
    text_data = pop_words [value] *3
    textSize (text_data)
    text ("\n". join (pop_words), 250, 50+text_data)



#Display on canvas

size (500, 500)
background (0)
fill (255)
textAlign (CENTER)
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to get my loop items on a different line</title>
      <link>https://forum.processing.org/two/discussion/24973/how-to-get-my-loop-items-on-a-different-line</link>
      <pubDate>Sun, 12 Nov 2017 14:07:29 +0000</pubDate>
      <dc:creator>111aei</dc:creator>
      <guid isPermaLink="false">24973@/two/discussions</guid>
      <description><![CDATA[<p>Okay, so I finally figured out how to display my loop items as text, by running a simple loop, however, I don't know how to make them appear one under the other.</p>

<p>example_list= [1,2,3, 4, 5]</p>

<pre><code>for elements in example_list:
    text (elements , 50, 50)
</code></pre>

<p>I should note, that I tried to create a variable for y, that took in the number of items, but that didn't quite work</p>
]]></description>
   </item>
   <item>
      <title>Find the nth occurrence of a specific character in a String</title>
      <link>https://forum.processing.org/two/discussion/23582/find-the-nth-occurrence-of-a-specific-character-in-a-string</link>
      <pubDate>Tue, 25 Jul 2017 23:08:23 +0000</pubDate>
      <dc:creator>albobz</dc:creator>
      <guid isPermaLink="false">23582@/two/discussions</guid>
      <description><![CDATA[<p>I am trying to write a function that returns the integer index value for the nth occurrence of a specified character c, like:</p>

<pre><code>int findNthChar(String a, char c, int n)
</code></pre>

<p>I know to use a while loop but am not too sure of the code within it.</p>
]]></description>
   </item>
   <item>
      <title>Problem with loadStrings</title>
      <link>https://forum.processing.org/two/discussion/22373/problem-with-loadstrings</link>
      <pubDate>Wed, 03 May 2017 22:12:11 +0000</pubDate>
      <dc:creator>AdrianG</dc:creator>
      <guid isPermaLink="false">22373@/two/discussions</guid>
      <description><![CDATA[<p>Hi there,
it seems to me, that the function loadStrings does not like to read String-variables.
I have an array with filenames and want to tell loadStrings to load each file one after another.
Like this:</p>

<p>for (int i = 0; i &lt; filenames.length; i++) { 
texts[i] = loadStrings(filenames[i]);
}</p>

<p>I would like to access and process many text files one after another. But how?</p>

<p>Thanks in advance!</p>

<p>Adrian</p>
]]></description>
   </item>
   <item>
      <title>for loop</title>
      <link>https://forum.processing.org/two/discussion/20282/for-loop</link>
      <pubDate>Sun, 15 Jan 2017 16:13:52 +0000</pubDate>
      <dc:creator>stirfry</dc:creator>
      <guid isPermaLink="false">20282@/two/discussions</guid>
      <description><![CDATA[<p>I'm not very good at for loops. What I'm trying to do is use the array of strings, created by the bufferedReader() function, and connect them together into one long string separated by new-lines. <br /> Part of the code:<br /></p>

<pre>
&nbsp;&nbsp;&nbsp;&nbsp;String[] messages = split(line, ENTER);
&nbsp;&nbsp;&nbsp;&nbsp;for (String i : messages) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fullMessage&nbsp;=&nbsp;fullMessage&nbsp;+&nbsp;&quot;/n&quot; + messages[i];
&nbsp;&nbsp;&nbsp;&nbsp;}

</pre>

<p><br />Thanks</p>
]]></description>
   </item>
   <item>
      <title>How to add a string of text to a String array on buttonClick?</title>
      <link>https://forum.processing.org/two/discussion/18728/how-to-add-a-string-of-text-to-a-string-array-on-buttonclick</link>
      <pubDate>Wed, 26 Oct 2016 15:20:50 +0000</pubDate>
      <dc:creator>Mitch_</dc:creator>
      <guid isPermaLink="false">18728@/two/discussions</guid>
      <description><![CDATA[<p>So basically i want my sketch to remember what the last ten buttons are that have been clicked. I will see later on if i can make it so that it only prints the last 10 items added to the array but first i need to know how to add a string of text to a String array on buttonClick.</p>

<p>If i run the following sketch and press ENTER i get null in the console.</p>

<pre><code>String[] buttons; 
String displayButtons;

void setup(){  
  buttons = new String[3]; 
  displayButtons = join(buttons, " : ");
}

void draw(){
}

void keyPressed() {
  if ((key=='1')) { 
   buttons[0] = "You pressed button one";
  }

  if ((key=='2')) { 
    buttons[1] = "You pressed button two";
  }

  if ((key==ENTER)) { 
    printArray(displayButtons);
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Word Counter Question</title>
      <link>https://forum.processing.org/two/discussion/15883/word-counter-question</link>
      <pubDate>Wed, 06 Apr 2016 16:29:35 +0000</pubDate>
      <dc:creator>ekinkes</dc:creator>
      <guid isPermaLink="false">15883@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I've got a sketch calculates the frequency of a word in a given text. <a rel="nofollow" href="http://imgur.com/SKL2itG">This</a> is the visual output. I want to add a line to the code like "if the frequency is greater than 15, start drawing 40 pixels down" to show the most frequent words at the same time on lines and columns. How can I achieve this? Thanks.</p>

<pre><code>//PFont font;
String[] yazi;    //text'in bagli oldugu array
int kelimeno = 0;   // text'in baslangic noktasi


String sonrakinegec = " ,.?!;:";

void setup() {
  size(500,500);

  // fontu yukle
  //font = loadFont( "CourierNewPSMT-24.vlw" );

  // text'i string array'ine yukle
  String[] rawtext = loadStrings("ham.txt");

  // butun array'i tek bir stringe cevir
  String everything = join(rawtext, "" );


  yazi = splitTokens(everything,sonrakinegec);
  frameRate(2);
}

void draw() {
  background(255);

  // kelimeyi yaz
  String theword = yazi[kelimeno];

// kelimeyi say
int total = 0;
  for (int i = 0; i &lt; yazi.length; i ++ ) {
    if (theword.equals(yazi[i])) {      
      total ++;
    }
  }

  // Display the text and total times the word appears
  //textFont(font);
  fill(0);
  float y=0;
  if (total&gt;=15) {
    y=y+40;
    print(theword+"-" +total+" ");
  }

  text(theword,10,90+y);
  text(total,10,110+y);
  stroke(0);
  fill(175);
  rect(10,50+y,total/4,20);

  // Move onto the next word
  kelimeno = (kelimeno + 1);


}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to add value to array</title>
      <link>https://forum.processing.org/two/discussion/15561/how-to-add-value-to-array</link>
      <pubDate>Fri, 18 Mar 2016 16:48:08 +0000</pubDate>
      <dc:creator>Raz</dc:creator>
      <guid isPermaLink="false">15561@/two/discussions</guid>
      <description><![CDATA[<p>I want to add a value to array which is controled by the keyboard. Like this:</p>

<pre>
 char[] a=new string[100];
char value="";

void draw(){
}
void keyPressed(){
value=key;
}
</pre>

<p>I want that  the value will be added to the array and when it changes the new value will be added to next index. how to do this?</p>
]]></description>
   </item>
   <item>
      <title>Search strings for words in between a tag?</title>
      <link>https://forum.processing.org/two/discussion/13226/search-strings-for-words-in-between-a-tag</link>
      <pubDate>Sat, 24 Oct 2015 15:05:00 +0000</pubDate>
      <dc:creator>bnjm</dc:creator>
      <guid isPermaLink="false">13226@/two/discussions</guid>
      <description><![CDATA[<p>How can I use Processing to search strings (Text from a webpage) and pull out the words in-between a tag, for example everything between <code>&lt;p&gt; and &lt;/p&gt;</code></p>
]]></description>
   </item>
   <item>
      <title>Why the text file shows messy date saved by output.println</title>
      <link>https://forum.processing.org/two/discussion/11084/why-the-text-file-shows-messy-date-saved-by-output-println</link>
      <pubDate>Sun, 31 May 2015 11:26:12 +0000</pubDate>
      <dc:creator>Hill</dc:creator>
      <guid isPermaLink="false">11084@/two/discussions</guid>
      <description><![CDATA[<p>I try to used output.println to save data (which from println) in a text file, but the data in the output text file is unreadable. I hope some friends can help me solve this problem.</p>

<p>Here is my code:</p>

<pre lang="javascript">
PrintWriter output;

float x,y,e;
int plate_width=50, plate_height=50;
boolean UP=true;
boolean RIGHT=true;

void setup(){
  size(100,100);
  x=40;
  y=40;
  output = createWriter("gcode.doc");
}

void draw(){
  if (UP) {
  y=y+0.2;
} else {
  y=y-0.2;
}
  
 if (y&gt;=plate_height) {
  x=x+0.2;
  UP=false;
  
 }
 
 if (y&lt;=40) {
   UP=true;
   x=x+0.2;
 }
 
 if (x&gt;plate_width) {
   stop();
 }
 
 String[] gcode=new String[7];

gcode[0]="G1";

gcode[1]="X";
gcode[2]=str(x);
gcode[3]="Y";
gcode[4]=str(y);
gcode[5]="E";
gcode[6]=str(e);

String[] str=new String[4];
str[0]=gcode[0];
str[1]=gcode[1]+gcode[2];
str[2]=gcode[3]+gcode[4];
str[3]=gcode[5]+gcode[6];
e=e+0.04488;


str=append(str,"");

println(str);

output.println(str);
}
</pre>
]]></description>
   </item>
   </channel>
</rss>