\hypertarget{eina_str_01_8c-example}{}\doxysection{eina\+\_\+str\+\_\+01.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile\ with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc\ -\/Wall\ -\/o\ eina\_str\_01\ eina\_str\_01.c\ `pkg-\/config\ -\/-\/cflags\ -\/-\/libs\ eina`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ main(\textcolor{keywordtype}{int}\ argc\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{char}\ **argv\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *names\ =\ \textcolor{stringliteral}{"{}Calvin;Leoben;D'anna;Simon;Doral;Six;Daniel;Sharon"{}};}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *str;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *tmp;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *prologue;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *part1\ =\ \textcolor{stringliteral}{"{}The\ Cylons\ were\ created\ by\ man.\ They\ evolved.\ They\ rebelled."{}};}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *part2\ =\ \textcolor{stringliteral}{"{}There\ are\ many\ copies.\ And\ they\ have\ a\ plan."{}};}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ **arr;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *time\_arr;}
\DoxyCodeLine{\ \ \ time\_t\ curr\_time;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{struct\ }tm\ *info;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga81b8137665b8a4d2cb38ca50017d4c74}{eina\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ arr\ =\ \mbox{\hyperlink{group__Eina__String__Group_ga677e3c802818743fcd224fd21bbcc071}{eina\_str\_split}}(names,\ \textcolor{stringliteral}{"{};"{}},\ 0);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ arr[i];\ i++)}
\DoxyCodeLine{\ \ \ \ \ printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ arr[i]);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ free(arr[0]);}
\DoxyCodeLine{\ \ \ free(arr);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ str\ =\ malloc(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char})\ *\ 4);}
\DoxyCodeLine{\ \ \ strcpy(str,\ \textcolor{stringliteral}{"{}bsd"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__String__Group_ga84a7c436eebb877663f8afb60508bce7}{eina\_str\_toupper}}((\textcolor{keywordtype}{char}\ **)\&str);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ str);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__String__Group_ga3ab5d0649bbe26eef4dfec9956afd355}{eina\_str\_tolower}}(\&str);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ str);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group__Eina__String__Group_gae94028d670f7da2a68d352908b463af3}{eina\_str\_has\_prefix}}(names,\ \textcolor{stringliteral}{"{}Calvin"{}}))}
\DoxyCodeLine{\ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Starts\ with\ 'Calvin'\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group__Eina__String__Group_ga99f1cef36865219a23d170c8ee0e3dc9}{eina\_str\_has\_suffix}}(names,\ \textcolor{stringliteral}{"{}sharon"{}}))}
\DoxyCodeLine{\ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Ends\ with\ 'sharon'\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{group__Eina__String__Group_ga8e811ae036188cc6c5549e5fe09ca1bc}{eina\_str\_has\_extension}}(names,\ \textcolor{stringliteral}{"{}sharon"{}}))}
\DoxyCodeLine{\ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Has\ extension\ 'sharon'\(\backslash\)n"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ tmp\ =\ \mbox{\hyperlink{group__Eina__String__Group_ga61b5e02cc4f8580d618826730dbe3b60}{eina\_str\_escape}}(\textcolor{stringliteral}{"{}They'll\ start\ going\ ripe\ on\ us\ pretty\ soon."{}});}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ tmp);}
\DoxyCodeLine{\ \ \ free(tmp);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ prologue\ =\ malloc(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char})\ *\ 106);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__String__Group_gae36d8226b2c2e320f64d8a946f960c7b}{eina\_str\_join\_len}}(prologue,\ 106,\ \textcolor{charliteral}{'\ '},\ part1,\ strlen(part1),\ part2,\ strlen(part2));}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ prologue);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__String__Group_gae28caa0c42c4e76ae584f22bd3615723}{eina\_strlcpy}}(str,\ prologue,\ 4);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ str);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ free(prologue);}
\DoxyCodeLine{\ \ \ free(str);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ str\ =\ malloc(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char})\ *\ 14);}
\DoxyCodeLine{\ \ \ sprintf(str,\ \textcolor{stringliteral}{"{}\%s"{}},\ \textcolor{stringliteral}{"{}cylons+"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__String__Group_ga9d340cfcfd1259f3ef76d314a974b0e0}{eina\_strlcat}}(str,\ \textcolor{stringliteral}{"{}humans"{}},\ 14);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ str);}
\DoxyCodeLine{\ \ \ free(str);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ curr\_time\ =\ time(NULL);}
\DoxyCodeLine{\ \ \ info\ =\ localtime(\&curr\_time);}
\DoxyCodeLine{\ \ \ time\_arr\ =\ \mbox{\hyperlink{group__Eina__String__Group_gae1c70b435ea2b7e52c46b466972223d2}{eina\_strftime}}(\textcolor{stringliteral}{"{}\%d/\%m/\%Y"{}},\ info);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Today's\ Date:\ \%s\(\backslash\)n"{}},\ time\_arr);}
\DoxyCodeLine{\ \ \ free(time\_arr);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga5bf35513199d5220341437c05696285d}{eina\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 