trim functions

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

does GCC have a trimLeft() or trim() like in c++? I have been codeing in c with avrs for a while, but now that Im more into USART and LCD's this is the first I have been playing with strings like this...

so what I really need is a trim command like:

string msg = "this is a string";
string = trimLeft(string,4);
output string;

outputs: "this"

or is there a way to use inline c++?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are several string functions in the standard library. A variant of strcpy will do what trimLeft does. Check in string.h for what is available. There is also printf which can be used for output (look in stdio.h). There is a section in the avr-gcc libc manual that explains how to set it up,as well as a thread in this forum. It allows you to set the output to where ever you want.

Regards,
Steve A.

The Board helps those that help themselves.