473,320 Members | 1,832 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,320 software developers and data experts.

Finding out substring

Sir, Mu question is finding substring in the main string but each time my string changing such as
first it may be "Sun Mon Tue"
second time it may be "Sun Tue Fri Sat"
or it may any any days or all days in a week.
Feb 11 '13 #1
1 957
IronRazer
83 64KB
Hello Savita Yadav,
If your string is "Sun Mon Tue" and you want to find "Mon" then try this :
Expand|Select|Wrap|Line Numbers
  1.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim Str1 As String = "Sun Mon Tue"
  3.         Dim Str2 As String = ""
  4.         If Str1.Contains("Mon") Then
  5.             Str2 = Str1.Substring(Str1.IndexOf("Mon"), 3)
  6.         End If
  7.     End Sub
  8.  
If your string contains "Mon" more than once and you want to find the last one in the string then use this :
Expand|Select|Wrap|Line Numbers
  1.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim Str1 As String = "Sun Mon Tue Wed Mon Fri"
  3.         Dim Str2 As String = ""
  4.         If Str1.Contains("Mon") Then
  5.             Str2 = Str1.Substring(Str1.LastIndexOf("Mon"), 3)
  6.         End If
  7.     End Sub
  8.  
Feb 11 '13 #2

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

Similar topics

4
by: cassandra.flowers | last post by:
Hi, This is a simple thing, but I'm having a bit of difficulty getting it exact. I've tried a few different codes, but can't do what I want, can some one help please? I have 3 text boxes,...
4
by: Victor Engmark | last post by:
When looking for a method to fetch unique elements and counting the number of occurences of each of them, I found quite a lot of gross examples of complex XSL. But after realizing the subtle...
5
by: richard_thomas | last post by:
Hi, I'm having trouble running the following query: select * from message where text_body like ' ----------%' ie, five spaces followed by at least ten hyphens. The query doesn't...
5
by: brettr | last post by:
When I reference document.cookie, there is a long string of key=value; pairs listed. I may have 100 hundred cookies on my hard drive. However, most only have one key=value pair. Does the...
5
by: giampiero mu | last post by:
hi everyone my target is implement a function controlla(string - a binary string-) that check if there is in a string two equal not overlapping subsequences at least of length limitem: my...
4
by: borges2003xx | last post by:
i have read finding sublist http://groups.google.it/group/comp.lang.python/browse_thread/thread/50b09a0aca285256/5156ada81fc9358a?hl=it#5156ada81fc9358a the problem was in a string to find if...
2
by: Badass Scotsman | last post by:
Hello, Using VB and ASP,NET I would like to be able to search a STRING for a smaller STRING within, based on the characters which appear before and after. For example: String1 = " That was...
2
by: Extremest | last post by:
Here is the code I have so far. It connects to a db and grabs headers. It then sorts them into groups and then puts all the complete ones into another table. Problem I am having is that for some...
2
by: jewel87 | last post by:
Hello, I've got a problem and would appreciate any help. I have to count the number of integers in a string like this "1.1 some text. 1.2 some text", where it should return 0, as there are no...
3
by: haran22 | last post by:
hi to all. I have a problem i finding substring. i have many strings in array one string as the value String s1="a|b" 2nd as the value String s2= "ab|cd" 3rd as the value String s3= "a|cde" i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.