teste de publish
Dependencies: DS1820 HighSpeedAnalogIn devices mbed
Diff: diversos.cpp
- Revision:
- 3:9598af355293
- Parent:
- 2:55b7b466e742
- Child:
- 4:13ff9c81dc10
--- a/diversos.cpp Wed May 10 12:57:13 2017 +0000 +++ b/diversos.cpp Mon May 22 20:08:46 2017 +0000 @@ -74,6 +74,29 @@ return f; }*/ +void diversos::strReplace(char *str, char *find, char *replace){ + char aux[100]; + char *ptr; + char replaced = 0; + char maxIterations = 0; + replaced = 0; + strcpy(aux,""); + ptr = strtok(str,find); + while((ptr!=NULL)&&(maxIterations<9)){ + replaced = 1; + maxIterations++; + strcat(aux,ptr); + strcat(aux,replace); + ptr = strtok(NULL,find); + pc.printf("Tirando <%s> em <%s>.\r\n",find,str); + } + if(replaced){ + aux[strlen(aux)-1]=0; + strcpy(str,aux); + } + //-------------------- +} + void diversos::progressBar(uint32_t progresso,uint32_t total){ int i,j; char maxTam = 20;