Quantcast
Channel: DIAdem topics
Viewing all articles
Browse latest Browse all 3196

Case sensitive string variable?

$
0
0

Hello,

 

I use the following code to determine whether I am opening a DAT file or a TDM file. Some of it is complicated by a bug in 2010 but that is not relevent for this particular problem. Up until today it has worked perfectly, probably because the TDM files I have been opening were written using code from the same autosequence. Today I was opening files saved by DIAdem using the standard save as toolbar button.

 

T2 = NameSplit(T1,"E") ' extract file extension

if T2 <> "TDM" then 'case sensitive??

CallDataLoadHdFile(T1) 'Temporary fix from NI until DataFileLoadSel problem is fixed

CallDataLoadSel(DATADRVUSER&T1, ChList_, 0) 'Temporary fix from NI until DataFileLoadSel problem is fixed

' Call DataFileLoadSel(DATADRVUSER&T1,T2,"[1]/["&ChList_&"]","") ' Load selected data channels from next file 'Commented out by SA 8/6/11, as it doesn't work in 2010

else

CallDataFileLoadSel(DATADRVUSER&T1,T2,"[1]/["&ChList_&"]","") ' Load selected data channels from next file

endif

 

The code failed because the file I was opening had the extension tdm, and thus the value of T2 was "tdm". I couldn't believe it but I wondered whether the if...then loop was case sensitive to the value of T2. It was... When I changed the second line of code as follows (i.e. lower case tdm) it worked.

 

if T2 <> "tdm" then'case sensitive??

 

It seems that when DIAdem saves files it applies a lower case extension but my code has applied uppercase letters. For reasons of backwards compatability I can't really change my code to save with lower cases.

I've tried using:

 

if T2 <> "TDM" or "tdm" then'case sensitive??

 

but that doesn't work.

 

So, my question is: how do I correct the 'or' statement so that it works, or is there a function I can use to make the if...then loop and/or T2 case insensitive?

 

Thanks.


Viewing all articles
Browse latest Browse all 3196

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>