Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB.NET STRING FUCNTION

Posted on 2010-11-30
2
Medium Priority
?
360 Views
Last Modified: 2012-06-21
Hello Experts

 I am getting a data from the database column in the following format, I am trying to retrieve the last word after ":"

Sometimes I may get 3 strings concatenated with colon or sometimes 4, regardless of this I want to get the last name

POSelID: p502<br>Ice Creams:Neapolitan
POSelID: p564:o26:6m<br>Film Quote Babygrow - The Force is Strong in This One:6m
POSelID: p502<br>Ice Creams:TestOption

Please can someone let me know how can I get the exact value after retrieving it from  the DB column,

AttributeName = UCase(row.Item("options"))  
ex: AttributeName = Neapolitan

Thanks
0
Comment
Question by:newbie27
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
Zhaolai earned 2000 total points
ID: 34240377
Try this:
Dim strTemp As String = "POSelID: p502<br>Ice Creams:Neapolitan"
        Dim strLastName As String = strTemp.Substring(strTemp.LastIndexOf(":") + 1)

Open in new window

0
 

Expert Comment

by:PhilosW
ID: 34240653
Try This:
         Dim _lstTemp As List(Of String) = "POSelID: p502<br>Ice Creams:Neapolitan".Split(":").ToList()
         Dim _lastName As String = _lstTemp(_lstTemp.Count - 1)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question