user5133: Hey all I am wondering if it's possible to modify the WString.cpp file to only include the commands that I need for my project since that file is so large.
I am using a Digispark arduino that is Attiny85 which only has about 6k flash memory after bootloader.
Needless to say I am almost out of flash memory and I still need to do a few things.
I am reading from a serial port (in this case, using DigiCDC for a virtual serial port).
How can I overwrite the default Strings class that looks like its built in to the IDE with my own modified String class so I can get a smaller footprint?
Thanks!

user7508: You can make a copy of WString.cpp, edit it, and add it to your project.
Note however that:

You will have to define every method that you use. Otherwise the
linker will pull WString.o from the Arduino core library in order to
resolve the missing methods, and then it will complain that some
methods have been defined twice.
Just pruning WString.cpp from unused methods will not help: the
linker is already doing that for you.
To know which functions/methods of your program are taking too much
flash, you can use the command
avr-nm --size-sort -Crtd program.elf.
I second Majenko in recommending against String objects if possible.


5133: <p>Hey all I am wondering if it's possible to modify the WString.cpp file to only include the commands that I need for my project since that file is so large.</p>

<p>I am using a Digispark arduino that is Attiny85 which only has about <strong>6k flash memory after bootloader</strong>.</p>

<p>Needless to say I am almost out of flash memory and I still need to do a few things.</p>

<p>I am reading from a serial port (in this case, using <a href="https://digistump.com/wiki/digispark/tutorials/digicdc" rel="nofollow">DigiCDC</a> for a virtual serial port).</p>

<p>How can I overwrite the default Strings class that looks like its built in to the IDE with my own modified String class so I can get a smaller footprint?</p>

<p>Thanks!</p>
 7508: <p>You can make a copy of WString.cpp, edit it, and add it to your project.
Note however that:</p>

<ol>
<li>You will have to define <em>every method</em> that you use. Otherwise the
linker will pull WString.o from the Arduino core library in order to
resolve the missing methods, and then it will complain that some
methods have been defined twice.</li>
<li>Just pruning WString.cpp from unused methods will not help: the
linker is already doing that for you.</li>
<li>To know which functions/methods of your program are taking too much
flash, you can use the command
<a href="https://arduino.stackexchange.com/a/12684"><code>avr-nm --size-sort -Crtd program.elf</code></a>.</li>
<li>I second Majenko in recommending against String objects if possible.</li>
</ol>
