Current issue

Vol.26 No.4

Vol.26 No.4

Volumes

© 1984-2017
British APL Association
All rights reserved.

Archive articles posted online on request: ask the archivist.

archive/16/3

Volume 16, No.3

This article might contain pre-Unicode character-mapped APL code.
See here for details.

PROPER Capitals

From: Adam KerteszNov 1999

Here is a little utility which capitalizes the first letter in a text string and any other letters in text that follow any character other than a letter.


    ’ R A PROPER B;ALLC;BOOL;FIRST;IND;K;LC;N;P;UC;X; IO
[1]   © Adam Kertesz, 03/20/1998+05/21/1999
[2]   ©      To change text into ¨Proper¨ format
[3]   ©      B is a character vector to change
[4]   ©      A is a two part exception list, both vector of vectors
[5]   ©      If not exists: empty
[6]   ©      If exists: [1] remain as is , e.g. APL APL, WfWG WfWG
[7]   ©                 [2] should be all lowercase, e.g. AND and
[8]     IO 0
[9]    :IF 2 NC 'A' ª A 2½ ''
[10]   :ENDIF
[11]   (A N) 2 A ª B ,B
[12]   UC  AV[( AV¼'A')+¼26] ª LC  AV[( AV¼'a')+¼26] ª ALLC UC,LC
[13]   BOOL B¹ALLC ª FIRST 1 ª R ''
[14]   :WHILE 0<½B
[15]     X +/^\BOOL=BOOL[0] ª K X B ª B X B
[16]     :IF BOOL[0]
[17]     :ANDIF ~( K)¹A
[18]       IND ALLC¼K ª P (( K)¹N) FIRST ª K[0] UC[26|IND[0]] ª
            K[P ¼½K] LC[26|P IND]
[19]     :ENDIF
[20]     R R,K ª FIRST FIRST>BOOL[0] ª BOOL X BOOL
[21]   :ENDWHILE
    ’
	PROPER 'this is a TITLE'
This Is A Title

	PROPER '76budGet' 
76Budget

	PROPER 'ATHENS, georgia'
Athens, Georgia

	LIST1 ''
	LIST2 'THIS' 'IS'  'A'
	(LIST1 LIST2) PROPER 'THIS IS A TITLE'
This is a Title

	LIST1 'APL'  'COBOL'
	LIST2 'ARE'  'AND'
	(LIST1 LIST2) PROPER 'APL AND COBOL ARE LANGUAGES.'
APL and COBOL are Languages.

	(LIST1 LIST2) PROPER 'ARE APL AND COBOL LANGUAGES?'
Are APL and COBOL Languages?

script began 11:37:16
caching off
debug mode off
cache time 3600 sec
indmtime not found in cache
cached index is fresh
recompiling index.xml
index compiled in 0.2606 secs
read index
read issues/index.xml
identified 26 volumes, 101 issues
array (
  'id' => '10004530',
)
regenerated static HTML
article source is 'HTML'
source file encoding is ''
read as 'Windows-1252'
completed in 0.2867 secs