\hypertarget{eina_strbuf_01_8c-example}{}\section{eina\+\_\+strbuf\+\_\+01.\+c}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -Wall -o eina\_strbuf\_01 eina\_strbuf\_01.c `pkg-config --cflags --libs eina`}

\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <\hyperlink{Eina_8h}{Eina.h}>}

\textcolor{keywordtype}{int} main(\textcolor{keywordtype}{int} argc \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}, \textcolor{keywordtype}{char} **argv EINA\_UNUSED)
\{
   \hyperlink{struct__Eina__Strbuf}{Eina\_Strbuf} *buf, *substr;

   \hyperlink{group__Eina__Main__Group_gabf448ada5bc81a07342b66c6f818ee5e}{eina\_init}();

   buf = \hyperlink{group__Eina__String__Buffer__Group_ga83a74d63ed9f602c8653e99282e74e78}{eina\_strbuf\_new}();

   \hyperlink{group__Eina__String__Buffer__Group_ga020109f080ebe17ebd6a45675842d686}{eina\_strbuf\_append\_length}(buf, \textcolor{stringliteral}{"BUFFE"}, 5);
   \hyperlink{group__Eina__String__Buffer__Group_ga74180672d940d88653aa68e3717432ca}{eina\_strbuf\_append\_char}(buf, \textcolor{charliteral}{'R'});
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));

   \hyperlink{group__Eina__String__Buffer__Group_ga785cb6b648cb13ba56857d75ccea8543}{eina\_strbuf\_tolower}(buf);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));

   substr = \hyperlink{group__Eina__String__Buffer__Group_ga7c1976343dc069d4c98bc3ddf9020bb3}{eina\_strbuf\_substr\_get}(buf, 3, 2);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(substr));
   \hyperlink{group__Eina__String__Buffer__Group_ga35331525102f5cd40350c3951fbd2786}{eina\_strbuf\_free}(substr);

   \hyperlink{group__Eina__String__Buffer__Group_ga3291e2ce3e7d0e82bb47f4a32c8fbc0b}{eina\_strbuf\_insert\_escaped}(buf, \textcolor{stringliteral}{"my "}, 0);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));
   \hyperlink{group__Eina__String__Buffer__Group_ga59d4d2a65bff12844a9165e73fcadc03}{eina\_strbuf\_reset}(buf);

   \hyperlink{group__Eina__String__Buffer__Group_ga447e5835b53017615dfb487f062dd850}{eina\_strbuf\_append\_escaped}(buf, \textcolor{stringliteral}{"my buffer"});
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));
   \hyperlink{group__Eina__String__Buffer__Group_ga59d4d2a65bff12844a9165e73fcadc03}{eina\_strbuf\_reset}(buf);

   \hyperlink{group__Eina__String__Buffer__Group_ga534a406b49950cbde39b4b67d0739dfc}{eina\_strbuf\_append\_printf}(buf, \textcolor{stringliteral}{"%s%c"}, \textcolor{stringliteral}{"buffe"}, \textcolor{charliteral}{'r'});
   \hyperlink{group__Eina__String__Buffer__Group_gadc2a9499f87a3a962bf30878fc4c893e}{eina\_strbuf\_insert\_printf}(buf, \textcolor{stringliteral}{" %s: %d"}, 6, \textcolor{stringliteral}{"length"}, (\textcolor{keywordtype}{int})
      \hyperlink{group__Eina__String__Buffer__Group_ga7071b03b6963145842af987ff66c66db}{eina\_strbuf\_length\_get}(buf));
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));

   \hyperlink{group__Eina__String__Buffer__Group_ga62eb8cfd371cf3f01af5ea81a91ee0cf}{eina\_strbuf\_remove}(buf, 0, 7);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));

   \hyperlink{group__Eina__String__Buffer__Group_ga0bd961149bc1ef4d45ccac78529ba2b8}{eina\_strbuf\_replace\_all}(buf, \textcolor{stringliteral}{"length"}, \textcolor{stringliteral}{"size"});
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));
   \hyperlink{group__Eina__String__Buffer__Group_ga35331525102f5cd40350c3951fbd2786}{eina\_strbuf\_free}(buf);

   buf = \hyperlink{group__Eina__String__Buffer__Group_gada31ae30e6b6b0c554757560a3698a92}{eina\_strbuf\_manage\_read\_only\_new\_length}(\textcolor{stringliteral}{"Example string"}, 1
      4);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));

   \hyperlink{group__Eina__String__Buffer__Group_ga74180672d940d88653aa68e3717432ca}{eina\_strbuf\_append\_char}(buf, \textcolor{charliteral}{'.'});
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));

   \hyperlink{group__Eina__String__Buffer__Group_ga020109f080ebe17ebd6a45675842d686}{eina\_strbuf\_append\_length}(buf, \textcolor{stringliteral}{"Another string."}, 15);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, \hyperlink{group__Eina__String__Buffer__Group_gacaf291ef7ad6a66a196cdb17d6575ae2}{eina\_strbuf\_string\_get}(buf));

   \hyperlink{group__Eina__String__Buffer__Group_ga35331525102f5cd40350c3951fbd2786}{eina\_strbuf\_free}(buf);
   \hyperlink{group__Eina__Main__Group_ga6741fcaba116e31e96ce14dcfa03f568}{eina\_shutdown}();

   \textcolor{keywordflow}{return} 0;
\}
\end{DoxyCodeInclude}
 