Hi
If i want to use IN operator in VB , then how can i use it?
i mean i want to something like this
If Mid(WholeLine, 22, 3) In ("JAN" ,"FEB") then
but it gives me error.
i would appreciate any help.
thanks
15 1394
Hi
If i want to use IN operator in VB , then how can i use it?
i mean i want to something like this
If Mid(WholeLine, 22, 3) In ("JAN" ,"FEB") then
but it gives me error.
i would appreciate any help.
thanks
You can use inStr() function Like - If inStr(1,Mid(WholeLine, 22, 3), ("JAN" ,"FEB") ) > 0 then
thanks
i tried but still gives me error
thanks alot for quick answer
thanks
i tried but still gives me error
thanks alot for quick answer
can you post what you had tried and what is the error you are getting?
elseif inStr(1,Mid(WholeLine,22,3),("JAN,"FEB","MAR","APR "))>0 then
and it said
expected :)
thanks
elseif inStr(1,Mid(WholeLine,22,3),("JAN,"FEB","MAR","APR "))>0 then
and it said
expected :)
thanks
I am not getting what you mean!
What expected?
the error message is
Expected:)
this is my error message
do u want me to take printscreen?
Hi,
Try this code. It may suitable to you.
Switch(Mid("SampleTestingXXXXXXXXJAN", 22, 3) = "JAN", "JANUARY", _
Mid("SampleTestingXXXXXXXXJAN", 22, 3) = "FEB", "FEBRUARY")
Regards
------------
Mahesh
- elseif inStr(1,Mid(WholeLine,22,3),("JAN,"FEB","MAR","APR"))>0 then
Use like this - elseif inStr(1,("JAN FEB MAR APR"),Mid(WholeLine,22,3))>0 then
i will try now
but may i ask what is usage of that 1
what i want to do that if Mid(WholeLine, 22, 3) is equal to jan, feb,... dec,
then i be able to read that fiels and then do something
but i have no idead waht is the role of that 1 and why i have to say >0
thanks alot
i will try now
but may i ask what is usage of that 1
what i want to do that if Mid(WholeLine, 22, 3) is equal to jan, feb,... dec,
then i be able to read that fiels and then do something
but i have no idead waht is the role of that 1 and why i have to say >0
thanks alot
Just consider your - Mid(WholeLine, 22, 3) = "JAN"
-
'Then the inStr will look like
-
If InStr(1, ("JAN FEB MAR APR"), "JAN") > 0 Then
-
which means
inStr(<Start from Char 1>,<String content As String 1>, <Search String as string 2>) > 0
this > 0 meant string is available else not available Note : this inStr will return the possition of string 2 in string 1
thanks alot for your explanation. so i shouldnt put any comma between jan and feb?
if i put coma then it wont work
thankssssssssssssssss
... so i shouldnt put any comma between jan and feb?
if i put coma then it wont work
Actually, in this case it probably would. The Instr() function just tells you where inside a string it finds another string. If "JAN" is in there, it probably won't care whether there are commas, spaces or anything else around it.
No, Actully he/she mean "JAN", "FEB",.....etc
No, Actully he/she mean "JAN", "FEB",.....etc
Good point. Instr() is only designed to search one string, not a bunch of them. Of course, you could easily create a function to accept an array and do a search of it like Instr() if you wanted to. It could be a useful thing to have in one's toolkit.
Thanks for all helps
now secong problem is come up
as i said before the month can be different
the last 3 month is in differnt rows. but is going and just reading one line and i have same entry for my whole table.
my text file has two different king of data entry.
i have to read the date and the report type and member name.
then i dont need some lines and then i have to read the month. the last 3 month is usually there and then after i read the month name i read teh whole line.
but the main problem is that i am getting same information for everything.
the name of member or data will change but all the information that relate to the month is repeated same.
the first pasrt of my textfile is 19 line and then it is seperated with the second section with ----------------- (dash line)
then second format will started and then it will finish by some thing that is wrriteen END OF REPORT. again the first report will start.and then second type.
but i dont know how can i say that just read till line 19 and then stop when you see dash line.
because the way i did is that it is going and read line by line.
i did some thing like this that when MID(wholeline,9,3)= date then do this but it is not working properly.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Paul Davis |
last post by:
I'd like to overload 'comma' to define a concatenation operator for
integer-like classes. I've got some first ideas, but I'd appreciate a
sanity check. The concatenation operator needs to so...
|
by: joesoap |
last post by:
Hi can anybody please tell me what is wrong with my ostream operator???
this is the output i get using the 3 attached files.
this is the output after i run assignment2
-joesoap
#include...
|
by: Jason |
last post by:
Hello. I am trying to learn how operator overloading works so I wrote
a simple class to help me practice. I understand the basic opertoar
overload like + - / *, but when I try to overload more...
|
by: Martin Magnusson |
last post by:
I have defined a number of custom stream buffers with corresponding in
and out streams for IO operations in my program, such as IO::output,
IO::warning and IO::debug. Now, the debug stream should...
|
by: Sensei |
last post by:
Hi.
I have a problem with a C++ code I can't resolve, or better, I can't see
what the problem should be!
Here's an excerpt of the incriminated code:
=== bspalgo.cpp
// THAT'S THE BAD...
|
by: YUY0x7 |
last post by:
Hi, I am having a bit of trouble with a specialization of operator<<.
Here goes:
class MyStream
{
};
template <typename T>
MyStream& operator<<(MyStream& lhs, T const &)
|
by: gugdias |
last post by:
I'm coding a simple matrix class, which is resulting in the following
error when compiling with g++ 3.4.2 (mingw-special):
* declaration of `operator/' as non-function
* expected `;' before '<'...
|
by: raylopez99 |
last post by:
I need an example of a managed overloaded assignment operator for a
reference class, so I can equate two classes A1 and A2, say called
ARefClass, in this manner: A1=A2;. For some strange reason...
|
by: valerij |
last post by:
Yes, hi
How to write "operator +" and "operator =" functions in a class with
a defined constructor? The following code demonstrates that I don't
really understand how to do it... I think it has...
|
by: y-man |
last post by:
Hi,
I am trying to get an overloaded operator to work inside the class it
works on. The situation is something like this:
main.cc:
#include "object.hh"
#include "somefile.hh"
object obj,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
| |