New topic: 

Text Encoding?

<http://forums.realsoftware.com/viewtopic.php?t=46156>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        BrianOBrien          Post subject: Text Encoding?Posted: Thu Dec 
06, 2012 1:48 pm                                 
Joined: Wed Jul 07, 2010 2:55 pm
Posts: 630
Location: University Of Calgary, Faculty Of Medicine                I have a 
database query that returns a record set of strings.

I am looking for rows where a column has a lower case character in it.

do until rs.eof
  PatientID = rs.IdxField(1).StringValue
  UPatientID = PatientID.Uppercase
  if PatientID.left(1) = "f" then
  MsgBox("Halt")
  end if
  
  if PatientID <> UPatientID then
  listbox1.AddRow PatientID
  end if
  rs.MoveNext
Loop
The code halts at the MsgBox, but the Patient ID is FXXXX

I suspect this has something to do with text encoding but I'm not sure what.
For the moment lets assume that the text is ASCII.

Where did I go wrong:
1) In the column encoding at the database?
2) When I defined the PatientID string variable?      
_________________
If at first you don't succeed... Try REALBasic.  
                             Top                ktekinay          Post subject: 
Re: Text Encoding?Posted: Thu Dec 06, 2012 1:54 pm                              
   
Joined: Mon Feb 05, 2007 5:21 pm
Posts: 290
Location: New York, NY                The comparators (=, <, >, <=, >=, <>) 
don't take case into account so "f" does equal "F", always. Your second "if" 
statement will never be true either, so try this:
do until rs.eof
  PatientID = rs.IdxField(1).StringValue
  UPatientID = PatientID.Uppercase
  if StrComp( PatientID.Left(1), "f", 0 ) = 0 then
  MsgBox("Halt")
  end if
  
  if StrComp( PatientID, UPatientID, 0 ) <> 0 then
  listbox1.AddRow PatientID
  end if
  rs.MoveNext
Loop
      
_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.
  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to