<?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 replace() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=replace%28%29</link>
      <pubDate>Sun, 08 Aug 2021 20:11:24 +0000</pubDate>
         <description>Tagged with replace() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedreplace%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>printing 2darray as text...</title>
      <link>https://forum.processing.org/two/discussion/25042/printing-2darray-as-text</link>
      <pubDate>Thu, 16 Nov 2017 09:02:16 +0000</pubDate>
      <dc:creator>SlimJimCantSwim</dc:creator>
      <guid isPermaLink="false">25042@/two/discussions</guid>
      <description><![CDATA[<p>Hi, i've searched for a while and I'm not sure if i'm missing something obvious, i'm trying to print a 2d integer array as text, i did it before but I can't remember how i did and it is driving me insane.</p>

<p>thanks.</p>

<pre><code>void setup() {

  size(300, 300);
  background(255);
  array();
}

void array() {

  int[][] arrayinit = {
    { 10, 5, 3, 55, 90 }, 
    {  9, 4, 2, 32, 22 }, 
    {  3, 8, 5, 79, 22 }, 
    {  3, 8, 45, 4, 2 }, 
    {  3, 22, 5, 44, 4 }
  };

  int rows = 5;
  int cols = 5;

  int[] sum = new int[cols];
  int[] sum2 = new int[rows];
  stroke(0);
  for (int c=0; c&lt;cols; c++) { // for every column
    for (int r=0; r&lt;rows; r++) { // for every row
      rect(40*r, 30*c, 40, 30);
      text(arrayinit[c][r], 40*r, 30*c); //dont know if this is right
      sum[c] += arrayinit[r][c]; // sum up the values per column
      sum2[r] += arrayinit[r][c];
    }
  }

  println(sum[0]); 
  println(sum[1]); 
  println(sum[2]); 
  println(sum2[2]);
  println(arrayinit[2][2]);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Verb detection</title>
      <link>https://forum.processing.org/two/discussion/25267/verb-detection</link>
      <pubDate>Wed, 29 Nov 2017 12:44:31 +0000</pubDate>
      <dc:creator>je5c</dc:creator>
      <guid isPermaLink="false">25267@/two/discussions</guid>
      <description><![CDATA[<p>Does anyone have any experience or suggestions on how to create verb detection in a typed sentence. Essentially, someone would be able to type a sentence, and shortly after or with a button prompt, the verb(s) in the sentence are replaced e.g. "I read the story." to "I mis-read the story."</p>

<p>Any thoughts?</p>

<p>Thanks!
~jes</p>
]]></description>
   </item>
   <item>
      <title>How can I style specific words within a string?</title>
      <link>https://forum.processing.org/two/discussion/23783/how-can-i-style-specific-words-within-a-string</link>
      <pubDate>Sat, 12 Aug 2017 15:30:08 +0000</pubDate>
      <dc:creator>ishback</dc:creator>
      <guid isPermaLink="false">23783@/two/discussions</guid>
      <description><![CDATA[<p>I'm trying to apply styles to specific words within a string. For now I tried creating a paragraph that contains the styles inside (with the idea of appending each word with its style on a string):</p>

<p><code>var paragraph = "hello &lt;span style=\"color:blue;\"&gt;blueeee&lt;/span&gt; adios";
txt = createP(paragraph);</code></p>

<p>For some reason when this is rendered in html, it introduces quotation marks:</p>

<p><code>&lt;p&gt;
  "hello "
  "span style=\"color:blue;\"&gt;blueeee&lt;/span&gt;"
  " adios"
&lt;/p&gt;</code></p>

<p>Another alternative I though about would be to append word by word (with they specific style), but I'm not sure how to avoid the line break.</p>

<p>Any suggestions? Thanks!</p>
]]></description>
   </item>
   <item>
      <title>Replace Backslash by Normal Bar in a string with Processing</title>
      <link>https://forum.processing.org/two/discussion/21965/replace-backslash-by-normal-bar-in-a-string-with-processing</link>
      <pubDate>Wed, 12 Apr 2017 21:19:13 +0000</pubDate>
      <dc:creator>Jose_Aparecido</dc:creator>
      <guid isPermaLink="false">21965@/two/discussions</guid>
      <description><![CDATA[<p>Hello guys,</p>

<p>I'm trying to load some images using the selectFolder function, the problem is that it looks like in Processing it needs to be with the normal bar, rather than the inverted one.</p>

<p>For example, the folder I chose looks like this: C:\Images and it would look like this: C:/Images</p>

<p>I tried to use the replaceAll function to override in the String, but it is not working.</p>

<p>Below is the example.</p>

<pre><code>private String pathImg;

void setup() {
  selectFolder("Select a folder to process:", "folderSelected");  
}

void folderSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    pathImg = selection.getAbsolutePath();
    //String newPath = pathImg.replaceAll("\", "/");
    //pathImg = newPath;
    println("Path: " + pathImg);
  }
}
</code></pre>

<p>Thanks for listening</p>
]]></description>
   </item>
   <item>
      <title>Apostrophes/Quotation marks from loadStrings()?</title>
      <link>https://forum.processing.org/two/discussion/21754/apostrophes-quotation-marks-from-loadstrings</link>
      <pubDate>Sun, 02 Apr 2017 01:57:22 +0000</pubDate>
      <dc:creator>hpike2020</dc:creator>
      <guid isPermaLink="false">21754@/two/discussions</guid>
      <description><![CDATA[<p>I have a lot of larger blocks of text for my recent project, and I wanted to use a .txt file and loadStrings() to store/use them. However, the apostrophes and quotation marks in the text won't display correctly. I tried adding the usual backslash, but then the backslash is just displayed next to the unloaded character. This has happened both when using println() and text(). Any suggestions?</p>

<p>Original text:</p>

<p>Plastic can’t be broken down by marine microorganisms, so while plastic debris gets smaller, it doesn’t go away. “Ocean confetti” has been found in every area and depth of the ocean, and we still don’t know much about its effects.</p>

<p>Code:</p>

<pre><code>        void setup() {
              /*loading text into a string array (I have a lot, but only one has apostrophes and 
              quotation marks so I'll just use lines[4]*/
              String[] lines = loadStrings("strings.txt");
              //dislay text
              println(lines[5]);
            }
</code></pre>

<p>Output:
<img src="https://forum.processing.org/two/uploads/imageupload/836/B0D0M2J22ZL4.png" alt="Screen Shot 2017-04-01 at 6.55.39 PM" title="Screen Shot 2017-04-01 at 6.55.39 PM" /></p>

<p>Output when I add backslashes in the .txt file:
<img src="https://forum.processing.org/two/uploads/imageupload/951/75VO4AYUNKHY.png" alt="Screen Shot 2017-04-01 at 6.59.22 PM" title="Screen Shot 2017-04-01 at 6.59.22 PM" /></p>
]]></description>
   </item>
   <item>
      <title>Replacing "PING" with "PONG" in string.</title>
      <link>https://forum.processing.org/two/discussion/17205/replacing-ping-with-pong-in-string</link>
      <pubDate>Sat, 18 Jun 2016 23:25:01 +0000</pubDate>
      <dc:creator>Googie85</dc:creator>
      <guid isPermaLink="false">17205@/two/discussions</guid>
      <description><![CDATA[<p>I am a newb to processing and have migrated from LiveCode. Just a quick question, not asking for a spoonfeed, just a general idea I should be looking at. The string contains PING and I am trying to replace it with PONG.</p>

<p>Many Thanks Guys!!</p>

<p>Matt.</p>
]]></description>
   </item>
   <item>
      <title>Removing url from string</title>
      <link>https://forum.processing.org/two/discussion/16277/removing-url-from-string</link>
      <pubDate>Tue, 26 Apr 2016 21:41:05 +0000</pubDate>
      <dc:creator>Bavo</dc:creator>
      <guid isPermaLink="false">16277@/two/discussions</guid>
      <description><![CDATA[<p>Hi all</p>

<p>I'm trying to remove the url's from strings, generated by tweets (using twitter4j)
I've been trying all sorts of things with no luck.</p>

<p>So Let's say I have a string containing</p>

<p>"Hello, follow me! <a href="http://google.com" target="_blank" rel="nofollow">http://google.com</a>"</p>

<p>or</p>

<p>"This is a tweet with an instagram photo <a href="https://instagr.am/blablabla" target="_blank" rel="nofollow">https://instagr.am/blablabla</a>"</p>

<p>I want to strip just the url from that string, but that url may be anything.</p>

<p>I've been trying things with regex, and other instructions I've found on the web, but I'm really lost. Could anyone point me in the right direction?</p>
]]></description>
   </item>
   <item>
      <title>nf() with period</title>
      <link>https://forum.processing.org/two/discussion/16206/nf-with-period</link>
      <pubDate>Sat, 23 Apr 2016 13:58:27 +0000</pubDate>
      <dc:creator>Ravenghost</dc:creator>
      <guid isPermaLink="false">16206@/two/discussions</guid>
      <description><![CDATA[<p>nf(random(3.0, 4.2), 1, 2);</p>

<p>Returns result with comma "," like 3,63.</p>

<p>How to return result with period "." like 3.63.</p>
]]></description>
   </item>
   <item>
      <title>Need help with some code (Number Pyramid)</title>
      <link>https://forum.processing.org/two/discussion/16145/need-help-with-some-code-number-pyramid</link>
      <pubDate>Wed, 20 Apr 2016 21:51:53 +0000</pubDate>
      <dc:creator>redcardinal</dc:creator>
      <guid isPermaLink="false">16145@/two/discussions</guid>
      <description><![CDATA[<p>I need help making a program that makes a pattern like this with 'for loops':</p>

<pre><code>                1
              1 2 1
            1 2 3 2 1
          1 2 3 4 3 2 1
        1 2 3 4 5 4 3 2 1
      1 2 3 4 5 6 5 4 3 2 1
    1 2 3 4 5 6 7 6 5 4 3 2 1
  1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to Deal With Spaces in File Paths</title>
      <link>https://forum.processing.org/two/discussion/16066/how-to-deal-with-spaces-in-file-paths</link>
      <pubDate>Sun, 17 Apr 2016 17:57:09 +0000</pubDate>
      <dc:creator>12markowitzr</dc:creator>
      <guid isPermaLink="false">16066@/two/discussions</guid>
      <description><![CDATA[<p>Hello!
I am attempting to launch a batch script from processing using the <code>launch()</code> command. After much experimentation I got it to work but I now need to make it user friendly. I am asking the user to find their own install of ffmpeg to run.</p>

<pre><code>void setup(){
     selectInput("Please find ffmpeg.bat", "launchStuff");
}

void launchStuff(File file){
     String filePath = file.getPath();
     launch("cmd /c start /w " + filePath);
}
</code></pre>

<p>The problem is that ffmpeg tends to download in Program Files (on Windows), which means that there are spaces in the file path. This causes the error <code>"C:/Program"</code> cannot be found. How do I deal with these spaces?</p>

<p>Thank you!</p>
]]></description>
   </item>
   <item>
      <title>substitute pattern in a string</title>
      <link>https://forum.processing.org/two/discussion/15907/substitute-pattern-in-a-string</link>
      <pubDate>Thu, 07 Apr 2016 19:13:47 +0000</pubDate>
      <dc:creator>gostinets</dc:creator>
      <guid isPermaLink="false">15907@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>Is there an easy way to find-replace characters sequence in Processing?
For example, as gsub function in R <a rel="nofollow" href="https://stat.ethz.ch/R-manual/R-devel/library/base/html/grep.html">(https://stat.ethz.ch/R-manual/R-devel/library/base/html/grep.html</a>)</p>
]]></description>
   </item>
   <item>
      <title>How to change char in String?</title>
      <link>https://forum.processing.org/two/discussion/15584/how-to-change-char-in-string</link>
      <pubDate>Sun, 20 Mar 2016 15:41:49 +0000</pubDate>
      <dc:creator>Raz</dc:creator>
      <guid isPermaLink="false">15584@/two/discussions</guid>
      <description><![CDATA[<p>How to change part of string to something else? Like:</p>

<pre>
 String a="14819021541";
</pre>

<p>I want for example that all the "1" will be change to something else (like "2"). How can I do that?</p>
]]></description>
   </item>
   <item>
      <title>Hashmap with integer , float and string values.</title>
      <link>https://forum.processing.org/two/discussion/14046/hashmap-with-integer-float-and-string-values</link>
      <pubDate>Thu, 17 Dec 2015 18:36:34 +0000</pubDate>
      <dc:creator>contax63</dc:creator>
      <guid isPermaLink="false">14046@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I would like to know if in Processing an hashmap con include interger and string value as python where the dictionary can include , numbers and string value.</p>

<p>To be more specific , I would like include into the hashmap something like this:
  ("key1" : 10, "key2" :"home", "key3" : 15,3)</p>

<p>In all documentation I see that is mentioned that key must be string and values integer or float , but I didn't find something that say that values can be mixed inside the same hashmap.</p>

<p>Thanks.</p>
]]></description>
   </item>
   <item>
      <title>How to count the repeated alphabet in sketch</title>
      <link>https://forum.processing.org/two/discussion/13665/how-to-count-the-repeated-alphabet-in-sketch</link>
      <pubDate>Thu, 26 Nov 2015 09:34:05 +0000</pubDate>
      <dc:creator>boomp</dc:creator>
      <guid isPermaLink="false">13665@/two/discussions</guid>
      <description><![CDATA[<p>I've a set of string it's a music lyric and l want to count how many repeated alphabets like how many A, B,C,D...</p>

<p>but after I searching around I only found the way to count the string not alphabetical letters. 
is there's anyway to do it?</p>

<p>thank you.</p>
]]></description>
   </item>
   <item>
      <title>Why is replaceAll() not working?</title>
      <link>https://forum.processing.org/two/discussion/13065/why-is-replaceall-not-working</link>
      <pubDate>Sat, 17 Oct 2015 11:07:36 +0000</pubDate>
      <dc:creator>sssonic</dc:creator>
      <guid isPermaLink="false">13065@/two/discussions</guid>
      <description><![CDATA[<p>In the following code, testDoc.txt is comprised of the single word 'Johnson'.  Why is my output 'Johnson' and not 'Wilson'?</p>

<pre><code>String [] doc = loadStrings("testDoc.txt");
String name = "Wilson";

for (int i=0; i&lt;doc.length; i++) { 
  doc[i].replaceAll("Johnson", name);
}

print(doc);
</code></pre>
]]></description>
   </item>
   <item>
      <title>How can  I change the format of the numbers from 1,9 (one point nine) to 1.9)?</title>
      <link>https://forum.processing.org/two/discussion/11106/how-can-i-change-the-format-of-the-numbers-from-1-9-one-point-nine-to-1-9</link>
      <pubDate>Mon, 01 Jun 2015 19:55:30 +0000</pubDate>
      <dc:creator>Mino32</dc:creator>
      <guid isPermaLink="false">11106@/two/discussions</guid>
      <description><![CDATA[<p>I want to change the format of the numbers with decimals because it is confusing when i have thousands (1,900) and decimals.</p>
]]></description>
   </item>
   <item>
      <title>Turkish Character Problem</title>
      <link>https://forum.processing.org/two/discussion/6820/turkish-character-problem</link>
      <pubDate>Mon, 18 Aug 2014 17:57:34 +0000</pubDate>
      <dc:creator>KsanochkaPjotr</dc:creator>
      <guid isPermaLink="false">6820@/two/discussions</guid>
      <description><![CDATA[<p>Hi, this question before and I have lived in the android asked in the forum, but could not get any answer. And I've had the problem in java mode. When it comes to my problem, I Turkish character text (); I can print with the function and 
I'm viewing in the editor. But Turkish characters println (); function can not print to the console. I can not process the characters. (Url operations, etc.).</p>

<p>I'm working on projects, so I can not perform. 
Java mode and the android mode, how can I solve this problem.</p>

<p><strong>I need your help too. Please share all your ideas. Before I could not get a clear answer to my problem. In fact, I could not ever get. I hope you can help.</strong></p>
]]></description>
   </item>
   </channel>
</rss>