473,414 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

How to extract only message from sms in VB.NET

Hi,

Im working in mobile application using vb.net.... I read the stored sms from my simcard using GSM modem connected to my system. The sms i retrived from sim contains all details like (date, time, phone number) etc..... My question is, how to retrive only message.

I have stored the complete sms in a variable..... i tried using split and substring functions..... I didnt get the solution ......


Thanks in advance :)
Sep 6 '08 #1
5 2623
Curtis Rutland
3,256 Expert 2GB
Well, post the format that you receive an sms in. Is it one long string? Is in an object?

Post it.
Sep 6 '08 #2
Well, post the format that you receive an sms in. Is it one long string? Is in an object?

Post it.

Thanks for your response......

following is the format of sms....

Expand|Select|Wrap|Line Numbers
  1. AT+CMGR=2
  2.  
  3. +CMGR: "REC READ","121",,"07/04/18,15:26:01+00"
  4. (1/2)Roam with Airtel at 56% reduced National roaming rates and no monthly rental. All local calls-Rs1.40/min, incoming calls-Rs1.75/min, STD calls-Rs2.40/mi
  5.  
  6. OK
  7.  
my requirement is, I need to extract only 4th line....
Sep 6 '08 #3
balabaster
797 Expert 512MB
Thanks for your response......

following is the format of sms....

Expand|Select|Wrap|Line Numbers
  1. AT+CMGR=2
  2.  
  3. +CMGR: "REC READ","121",,"07/04/18,15:26:01+00"
  4. (1/2)Roam with Airtel at 56% reduced National roaming rates and no monthly rental. All local calls-Rs1.40/min, incoming calls-Rs1.75/min, STD calls-Rs2.40/mi
  5.  
  6. OK
  7.  
my requirement is, I need to extract only 4th line....
When you say "the 4th line" is all that a single string, with a line feed at the end of each line? I'd say, figure out whether the end of line is a carriage return, a line feed or a combination of both and do a split. For example - if it's a carriage return and line feed: Let's say your data is held in the string variable Data

Dim UsefulData As String = Data.Split(vbCrLf)(3)

If it's just a line feed:

Dim UsefulData As String = Data.Split(vbLf)(3)

Have you tried those?...
Sep 7 '08 #4
When you say "the 4th line" is all that a single string, with a line feed at the end of each line? I'd say, figure out whether the end of line is a carriage return, a line feed or a combination of both and do a split. For example - if it's a carriage return and line feed: Let's say your data is held in the string variable Data

Dim UsefulData As String = Data.Split(vbCrLf)(3)

If it's just a line feed:

Dim UsefulData As String = Data.Split(vbLf)(3)

Have you tried those?...

Hi Bala,

Thanks a lot, your post gave me the solution.....

Arun :)
Sep 8 '08 #5
balabaster
797 Expert 512MB
Hi Bala,

Thanks a lot, your post gave me the solution.....

Arun :)
No problem, which worked? It's useful for other people to know should someone else search for a solution. I note that in many systems (UNIX for instance) that there is only a line feed (which I think is Chr(10) - or vbLF), but in Windows systems provide a carriage return and a line feed (as per the old typewriter) which is Chr(10) & Chr(13) ... or vbCrLf. Often when you're parsing text files, it's useful to remember that the text file may not have originally come from a Windows system, and as such, if your structure relies on an end of line, then you need to be aware of the differences.
Sep 10 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Don Crossman | last post by:
Assume a MYSQL table, foo. One column, bar datetime. Two rows: 2004-01-01 08:00:00 2004-02-01 08:00:00 select * from foo where extract(day from bar)=1; 2 rows in set...
7
by: William Payne | last post by:
Hello, I have a variable of type unsigned long. It has a number of bits set (with set I mean they equal one). I need to determine those bits and their position and create new numbers from them. For...
2
by: Darren Ferguson | last post by:
Hey all I am trying to extract the epoch from a timestamp variable in plpgsql. The function is as follows: create or replace function test() returns integer as ' declare _test timestamp with...
9
by: Sharon | last post by:
hi, I want to extract a string from a file, if the file is like this: 1 This is the string 2 3 4 how could I extract the string, starting from the 10th position (i.e. "T") and...
10
by: Robert Schultz | last post by:
I have a C/C++ file that I simply want to 'extract' a function from. Something like: extract <function name> <c or cpp file> I want it to return from the beginning of the function, to the end. ...
6
by: Mohammad-Reza | last post by:
Hi I want to extract icon of an exe file and want to know how. I look at the MSDN and find out that I can use ExtractIconEx() Windows API but in there are some changes to that api in c# I made...
9
by: flit | last post by:
Hello All, Using poplib in python I can extract only the headers using the .top, there is a way to extract only the message text without the headers? like remove the fields below: "...
7
by: erikcw | last post by:
Hi all, I'm trying to extract zip file (containing an xml file) from an email so I can process it. But I'm running up against some brick walls. I've been googling and reading all afternoon, and...
1
by: Edwin.Madari | last post by:
from each line separate out url and request parts. split the request into key-value pairs, use urllib to unquote key-value pairs......as show below... import urllib line = "GET...
5
by: Steve | last post by:
Hi all Does anybody please know a way to extract an Image from a pdf file and save it as a TIFF? I have used a scanner to scan documents which are then placed on a server, but I need to...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.