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

Return the value between two specified values...

Ok...I'm hoping someone has a simple solution for this problem.

I need to find the value between two other values.

For Instance:

the 44 quick brown foxes jumped over 33 fences

and I need to find anything between "brown" and "fences".

So, in this example, the value returned would be: foxes jumped over 33

Hope that makes sense?
Apr 29 '07 #1
7 1265
Killer42
8,435 Expert 8TB
Try using Instr() function to find them, and Mid() function to return the chunk of text. At a guess, you'll also need to use the Len() function to determine the length of your start/stop strings so you can adjust things accordingly.

I'm not going into greater detail, because this sounds suspiciously like a homework assignment, and we do not want to answer those for you.
Apr 29 '07 #2
Killer42...

Too funny. Nope...no homework here. (Sheesh...this must have been a really lame question!) I'm trying to learn VB 2005 to use in my business. I am watching training videos online and so far so good. (Used to fool around with QBasic years ago on an old Tandy hooked to a TV :)

Thanks for the help. I had thought about that idea but was thinking there might already be a built in class/function to support this without having to write a large chunk of code....no such luck.

The problem with my code right now using Instr() is that it is case sensitive.

So, it works fine if I am looking for the string "test" in "I took a test".....BUT if I search for "Test" the result is 0.

I've tried every single solution Microsoft has for converting a string to Upper, Lower, etc... but no such luck converting the value of the variable.

Thanks for the help though.
Apr 30 '07 #3
Killer42
8,435 Expert 8TB
So you'd be looking for a way to convert your text to UpperCASE, then? ;)

I wouldn't say your question was lame, but it did sound a lot like the kind of examples they dole out to people learning VB. Which is probably a good sign, huh.
Apr 30 '07 #4
So you'd be looking for a way to convert your text to UpperCASE, then? ;)

I wouldn't say your question was lame, but it did sound a lot like the kind of examples they dole out to people learning VB. Which is probably a good sign, huh.
Ok... I used UCase previously...here is my code:

Expand|Select|Wrap|Line Numbers
  1. Dim s As String
  2.         s = "test"
  3.         Console.WriteLine(UCase(s))
So, I then set a breakpoint and begin stepping through my code. After the line with UCase is executed, and I hover over the variable "s" to get it's value, the popup still shows that the value is "test" ....but not TEST.

Thanks for your patience...Redmond here I come!
Apr 30 '07 #5
Killer42
8,435 Expert 8TB
Ok... I used UCase previously...here is my code:

Expand|Select|Wrap|Line Numbers
  1. Dim s As String
  2. s = "test"
  3. Console.WriteLine(UCase(s))
So, I then set a breakpoint and begin stepping through my code. After the line with UCase is executed, and I hover over the variable "s" to get it's value, the popup still shows that the value is "test" ....but not TEST.

Thanks for your patience...Redmond here I come!
A function returns a value. It doesn't (usually) affect the values of the parameters you pass to it. So in other words, you are feeding in "test", and it is handing back "TEST" to the WriteLine method. If you want to use the uppercase version of the text for anything, you need to either use the Ucase() function everywhere, or (generally the more efficient method) assign it to a variable. For example...
Expand|Select|Wrap|Line Numbers
  1. Dim s As String
  2. Dim t As String
  3. s = "test"
  4. t = Ucase(s)
  5. Console.WriteLine(t)
This should produce the same output, but you now have both original (s) and uppercase (t) versions of the string to play with.
Apr 30 '07 #6
THANK YOU!

Man, why I couldn't find that in the piles of Microsoft Help is beyond me.

Much appreciation for your help.

I'm almost finished with the code and will post for others to benefit from...and probably get some good constructive criticism!

Thanks again.
May 1 '07 #7
Killer42
8,435 Expert 8TB
Hey, if you want criticism you've come to the right place. :D

Good luck!
May 1 '07 #8

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

Similar topics

7
by: junk_bucket | last post by:
Apparently the maximum value of SECQTY for all tablespaces at a site I am supporting is 131068 which is a pre version 6.2 maximum. Any insight would be appreciated. Spufi alter and catalogue...
1
by: Ken | last post by:
I wrote a function to use in queries that takes a date and adds or subtracts a certain length time and then returns the new value. There are times when my function needs to return Null values. ...
16
by: G Patel | last post by:
Hi, If I want to call functions that don't return int without declaring them, will there be any harm? I only want to assign the function(return value) to the type that it returns, so I don't...
20
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
7
by: Drum2001 | last post by:
I have created a database to track employee time. Within that, I have also created a report off the following query: SELECT ALLTasksFilter.ProjectName, Sum(.NumberOfCompletions) AS...
34
by: priyanka | last post by:
Hi, I was wondering if we could parse or do something in the executable( whose source language was C). How can I use some scripting language like perl/python to find out the information about...
5
by: Veeru71 | last post by:
Given a table with an identity column (GENERATED BY DEFAULT AS IDENTITY), is there any way to get the last generated value by DB2 for the identity column? I can't use identity_val_local() as...
9
by: Francois Grieu | last post by:
When running the following code under MinGW, I get realloc(p,0) returned NULL Is that a non-conformance? TIA, Francois Grieu #include <stdio.h> #include <stdlib.h>
11
by: polas | last post by:
Good afternoon all, I appreciate that the standard requires that main should return an integer. What I was wondering though is there any accepted standardisation on exactly what value to return...
50
by: Bill Cunningham | last post by:
I have just read atoi() returns no errors. It returns an int though and the value of the int is supposed to be the value of the conversion. It seems to me that right there tells you if there was...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.