Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / March 2008

Tip: Looking for answers? Try searching our database.

string handling in vb.net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
deepak - 24 Mar 2008 09:07 GMT
Hi All,

 I have a string which can have ONLY ONE mobile number or multiple mobile
numbers(seperated by semi colon).

dim str as string = "+919886735837;+919820444818;+919916302180"

OR in this below format

dim str as string =""+919886735837"

depending upon the user who is using the interface and will fill this
textbox on the interface.

I need to handle the below message in the vb.net code.(this have mutiple
mobile numbers so i need to make the no. of messages equal to the count of
mobile numbers

e.g.this message
********************************************************************
<SXPSMSInformation
Destination="India_SMS"><Engineers><Engineer><CellNumber>+919886735837;+919820444818;+919886894326;+919886573423</CellNumber></Engineer></Engineers><Task><EquipmentType><Name>BSC</Name></EquipmentType><NOCRefID>Deepak_0324_1</NOCRefID><Priority>1</Priority><Site>BSC
_PB_BSC1_ BTS CHD190</Site><Status><Name>Dispatched</Name></Status><Title>The
work order
title</Title></Task><Assignment><Start>2008-03-24T11:45:00</Start></Assignment></SXPSMSInformation>
*****************************************************************

should be broken into 4 similar messages (each having single mobile numbers)

like (4 messages shown below)
**************************************************************************
<SXPSMSInformation
Destination="India_SMS"><Engineers><Engineer><CellNumber>+919886735837</CellNumber></Engineer></Engineers><Task><EquipmentType><Name>BSC</Name></EquipmentType><NOCRefID>Deepak_0324_1</NOCRefID><Priority>1</Priority><Site>BSC
_PB_BSC1_ BTS CHD190</Site><Status><Name>Dispatched</Name></Status><Title>The
work order
title</Title></Task><Assignment><Start>2008-03-24T11:45:00</Start></Assignment></SXPSMSInformation>

<SXPSMSInformation
Destination="India_SMS"><Engineers><Engineer><CellNumber>+919820444818</CellNumber></Engineer></Engineers><Task><EquipmentType><Name>BSC</Name></EquipmentType><NOCRefID>Deepak_0324_1</NOCRefID><Priority>1</Priority><Site>BSC
_PB_BSC1_ BTS CHD190</Site><Status><Name>Dispatched</Name></Status><Title>The
work order
title</Title></Task><Assignment><Start>2008-03-24T11:45:00</Start></Assignment></SXPSMSInformation>

<SXPSMSInformation
Destination="India_SMS"><Engineers><Engineer><CellNumber>+919886894326</CellNumber></Engineer></Engineers><Task><EquipmentType><Name>BSC</Name></EquipmentType><NOCRefID>Deepak_0324_1</NOCRefID><Priority>1</Priority><Site>BSC
_PB_BSC1_ BTS CHD190</Site><Status><Name>Dispatched</Name></Status><Title>The
work order
title</Title></Task><Assignment><Start>2008-03-24T11:45:00</Start></Assignment></SXPSMSInformation>

<SXPSMSInformation
Destination="India_SMS"><Engineers><Engineer><CellNumber>+919886573423</CellNumber></Engineer></Engineers><Task><EquipmentType><Name>BSC</Name></EquipmentType><NOCRefID>Deepak_0324_1</NOCRefID><Priority>1</Priority><Site>BSC
_PB_BSC1_ BTS CHD190</Site><Status><Name>Dispatched</Name></Status><Title>The
work order
title</Title></Task><Assignment><Start>2008-03-24T11:45:00</Start></Assignment></SXPSMSInformation>

*************************************************************************

Also, validation check should be added like e.g. user did not added the
semicolon  or + sign (befor the number) in the interface etc.

I want to handle the count of mobile numbers based on the semicolon(not on
'+' sign as user can entre 00 instead of '+' sign)

Kindly help me .

Thanks,
Deepak
kr_deepak123@hotmail.com
Martin Honnen - 24 Mar 2008 13:01 GMT
> I need to handle the below message in the vb.net code.(this have mutiple
> mobile numbers so i need to make the no. of messages equal to the count of
[quoted text clipped - 10 lines]
>
> should be broken into 4 similar messages (each having single mobile numbers)

Here is an example that simply uses String.Split

        Dim doc As XmlDocument = New XmlDocument()
        doc.Load("input.xml")
        Dim info As XmlNode =
doc.SelectSingleNode("root/SXPSMSInformation")
        If info IsNot Nothing Then
            Dim cellNumber As XmlNode =
info.SelectSingleNode("Engineers/Engineer/CellNumber")
            Dim numbers As String = cellNumber.InnerText
            cellNumber.InnerText = ""
            For Each number As String In numbers.Split(New Char() {";"})
                Dim newInfo As XmlNode = info.Clone()

newInfo.SelectSingleNode("Engineers/Engineer/CellNumber").InnerText = number
                doc.DocumentElement.AppendChild(newInfo)
            Next
            info.ParentNode.RemoveChild(info)
        End If
        doc.Save("result.xml")

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.