AGH UST MBED part 2

Dependencies:   LCD_DISCO_F429ZI mbed BSP_DISCO_F429ZI

Revision:
7:34a9bd9d3093
Parent:
6:06ff453bb16e
--- a/decoder.cpp	Fri May 22 07:30:59 2020 +0000
+++ b/decoder.cpp	Fri May 22 08:45:37 2020 +0000
@@ -1,5 +1,5 @@
 #include "decoder.h"
-
+#include <algorithm>
 
 struct Keyword asKeywordList[MAX_KEYWORD_NR] = {
     {ID, "id"},
@@ -11,15 +11,6 @@
 enum Result { OK, NOK };
 
 
-void Decoder::ReplaceCharactersInString(char pcString[],char cOldChar,char cNewChar){
-  
-    unsigned char ucCharCounter;
-  
-    for(ucCharCounter=0;pcString[ucCharCounter]!='\0';ucCharCounter++){
-        if(pcString[ucCharCounter] == cOldChar) pcString[ucCharCounter] = cNewChar;
-    }
-}
- 
 unsigned char Decoder::ucFindTokensInString(char *pcString){
   
     unsigned char ucTokenPointer;
@@ -87,7 +78,7 @@
 void Decoder::DecodeMsg(char *pcString){
   
     ucTokenCnt = ucFindTokensInString(pcString);
-    ReplaceCharactersInString(pcString,' ','\0');
+    std::replace(pcString, pcString + strlen(pcString), ' ', '\0');
     DecodeTokens(ucTokenCnt);
 }