Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Question in Char Separating

Status
Not open for further replies.

brian25

Member level 2
Joined
Feb 18, 2013
Messages
52
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,601
how to separate the content of a char ex. Hello World then i will store the World in byte? tnx
 

Hi Brain,
what do you want ..... I mean you want to seperate each character or world..... I mean
Input String -
"Hello World then i will store the World in byte?"

then output that you want -

Case-1

arrayWord=[ "Hello","World","then","i","will","store","the","World","in","byte?"] // like this then you need use space separation method

Case-2

arrayChar=[ 'H','e','l','l','o',' ','W', ..........] // then you need to convert string in to array of individual char

Good Luck
 
  • Like
Reactions: brian25

    brian25

    Points: 2
    Helpful Answer Positive Rating
yes i want to disregard the Hello and get only the Wolrd and store it in Byte/Char Array..

i'm using a gsm lib then i want to get the message from smsbuffer.
 

More specifically you need to have First World as Hello or it changes based on other message I mean ....

Case-1
String1 = "Hello How are you" - String1Arrya = ["How", "are" , "you"] // Hello as signature word and " " / Space as separator for decomposition
String2 = "Hello I am Fine" - String2Array =["I", "am", "Fine"] // Hello as signature word and " " / Space as separator for decomposition

Case-2

String1 = " brian25 How are you" - String1Arrya = ["How", "are" , "you"] // first word(brian25) as signature word and " " / Space as separator for decomposition
String2 = "Milind I am Fine" - String2Array =["I", "am", "Fine"] // first word(Milind) as signature word and " " / Space as separator for decomposition

what is the case that you are looking for.....

Good Luck
 
  • Like
Reactions: brian25

    brian25

    Points: 2
    Helpful Answer Positive Rating
Hi i think you need to do "Hello world" to "World" right ???

Code C - [expand]
1
2
3
4
5
6
7
8
9
for(i = 0; input_buf[i]  != ' ' ; i++);
 
i++;
offset = i;
 
for(; input_buf[i]  != ' ' && input_buf[i]  != '\0' ; i++)
{
out_buf[i - offset] = input_buf[i];
}


this will do so........
 
  • Like
Reactions: brian25

    brian25

    Points: 2
    Helpful Answer Positive Rating
i used arduino lib

Regexp

Code:
MatchState ms;
  char * str = smsbuffer;
  ms.Target (str);
  
  unsigned int index = 0;
  char buf [100];
  
  while (true)
  {
  char result = ms.Match ("(%a+)" "(%-?%d+)", index);
  
   if (result == REGEXP_MATCHED){
     for (int j = 0; j < ms.level; j++);
     gsm.WritePhoneNumber(result[j],(%-?%d+);
     index = ms.MatchStart + ms.MatchLength;
   }
   else 
     break;
  }
}

can you help how to correct this one.. tnx
 

Hi there is lot of mistakes, can you post the MatchState structure definition and what you need to pass from what in your gsm.WritePhoneNumber() ??
 
  • Like
Reactions: brian25

    brian25

    Points: 2
    Helpful Answer Positive Rating
i need to pass the user phone number in WritePhoneNumber(byte position, char *phone_number), then in the position i need an index to store atleast 2~4 user
btw the code i will use is like this Add 02321135466
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top