Post Reply 
ToUpper() ?
03-12-2015, 06:25 AM (This post was last modified: 03-12-2015 06:30 AM by bobkrohn.)
Post: #17
RE: ToUpper() ?
Here's my versions of UCase and LCase.
Easy to understand.
Actually this concept can be adapted to many other uses.
Like a Filter.
The BITAND & BITOR versions above didn't work correctly.
This version works with spaces, numbers, etc.

Code:

EXPORT UCase(MyText)
BEGIN

LOCAL i,test,temp,c;

test:="abcdefghijklmnopqrstuvwxyz";
temp:="";
c:="";

FOR i FROM 1 TO DIM(MyText) DO
  c := MID(MyText,i,1);
  IF INSTRING(test,c) THEN
    temp := temp + CHAR((ASC(c)-32)); 
  ELSE
    temp := temp + c; 
  END;  
END;

RETURN temp; 
//-----
END;



EXPORT LCase(MyText)
BEGIN

LOCAL i,test,temp,c;

test := "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
temp := "";
c := "";

FOR i FROM 1 TO DIM(MyText) DO
  c := MID(MyText,i,1);
  IF INSTRING(test,c) THEN
    temp := temp + CHAR((ASC(c)+32)); 
  ELSE
    temp := temp + c; 
  END;  
END;

RETURN temp; 
//-----
END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
ToUpper() ? - Angus - 03-09-2015, 01:02 PM
RE: ToUpper() ? - Thomas_Sch - 03-09-2015, 06:41 PM
RE: ToUpper() ? - PANAMATIK - 03-09-2015, 07:50 PM
RE: ToUpper() ? - Mark Hardman - 03-09-2015, 08:25 PM
RE: ToUpper() ? - jebem - 03-09-2015, 08:45 PM
RE: ToUpper() ? - Angus - 03-10-2015, 06:27 AM
RE: ToUpper() ? - cyrille de brébisson - 03-10-2015, 06:28 AM
RE: ToUpper() ? - Claudio L. - 03-12-2015, 04:19 PM
RE: ToUpper() ? - Didier Lachieze - 03-10-2015, 07:51 AM
RE: ToUpper() ? - Thomas_Sch - 03-10-2015, 08:10 AM
RE: ToUpper() ? - Angus - 03-10-2015, 08:10 AM
RE: ToUpper() ? - Didier Lachieze - 03-10-2015, 08:34 AM
RE: ToUpper() ? - Angus - 03-10-2015, 08:26 AM
RE: ToUpper() ? - Angus - 03-10-2015, 09:16 AM
RE: ToUpper() ? - Didier Lachieze - 03-10-2015, 12:12 PM
RE: ToUpper() ? - Tim Wessman - 03-10-2015, 12:55 PM
RE: ToUpper() ? - BruceH - 03-11-2015, 11:44 PM
RE: ToUpper() ? - bobkrohn - 03-12-2015 06:25 AM
RE: ToUpper() ? - cyrille de brébisson - 03-12-2015, 03:49 PM
RE: ToUpper() ? - bobkrohn - 03-12-2015, 04:44 PM
RE: ToUpper() ? - Didier Lachieze - 03-12-2015, 04:53 PM
RE: ToUpper() ? - bobkrohn - 03-12-2015, 08:05 PM
RE: ToUpper() ? - DrD - 03-12-2015, 08:44 PM
RE: ToUpper() ? - cyrille de brébisson - 03-13-2015, 06:18 AM
RE: ToUpper() ? - bobkrohn - 03-13-2015, 11:28 PM
RE: ToUpper() ? - DrD - 03-14-2015, 04:45 AM
RE: ToUpper() ? - cyrille de brébisson - 03-17-2015, 07:11 AM



User(s) browsing this thread: 1 Guest(s)