|
|
|
| 28 March 2002 | IsUpper() |
| Author | Humberto Roche-García(Puerto Rico) |
| Action | This function determines supplied string is uppercase. |
| Syntax | IsUpper ($ExpC, OPTIONAL $ExpTrig) |
| Parameters | |
| Remarks | NOTE: This function now combines IsAUpper() and IsUpper() in one ISUPPER function. Also changed return value for ISUPPER to be as 1 in order to comply with standards on other programming languages. No negative numbers on $ExpTrig. Does not skip Special Chars and numbers. Does not skip Empty strings. |
| Returns | Returns 1 if evaluated character(s) is/are in Uppercase. Returns 0 if evaluated character(s) is/are not Uppercase. |
| Dependencies | None. |
| Examples |
Examples ? "-----ISUPPER"
$THIS = ISUPPER("")
? "THIS=0 compare to $THIS"
$THIS = ISUPPER(0)
? "THIS=0 compare to $THIS"
$THIS = ISUPPER("Hola")
? "THIS=1 compare to $THIS"
$THIS = ISUPPER("hola")
? "THIS=0 compare to $THIS"
$THIS = ISUPPER("1OLA")
? "THIS=0 compare to $THIS"
$THIS = ISUPPER("HOLA", 7)
? "THIS=0 compare to $THIS"
$THIS = ISUPPER("hola",2)
? "THIS=0 compare to $THIS"
$THIS = ISUPPER("hola Bob",5)
? "THIS=0 compare to $THIS"
$THIS = ISUPPER("hola Bob",6)
? "THIS=1 compare to $THIS"
$THIS = ISUPPER("holA",4)
? "THIS=1 compare to $THIS"
$THIS = ISUPPER("hola", 0)
? "THIS=0 compare to $THIS"
$THIS = ISUPPER("HOLA", 0)
? "THIS=1 compare to $THIS"
$THIS = ISUPPER("HOLA", -1)
? "THIS=0 compare to $THIS"
|
| Source |
FUNCTION IsUpper ($expc, OPTIONAL $exptrig)
; Not $ExpTrig passed then to determine whether the leftmost character in a string is Upper Case
; With $ExpTrig = 0 then to evaluate all characters of supplied string for Upper Case
; With $ExpTrig > 0 evaluate the Nth character of supplied string for Upper Case
; No negative numbers on $ExpTrig
; Does not skip Special Chars and numbers
; Does not skip Empty strings
; Returns 1 if evaluated character(s) is/are in Upper Case
; Returns 0 if evaluated character(s) is/are not Upper Case
$isupper = 0
IF Len($expc) >= 1
IF $exptrig <> ""
IF $exptrig > 0 ; Evaluate Nth character if supplied string
IF $exptrig <= Len($expc)
IF Asc(Substr($expc, $exptrig, 1)) >= 65 AND Asc(Substr($expc, $exptrig, 1)) <= 90
$isupper = 1
ENDIF
ENDIF
ELSE
IF $exptrig = 0 ; Not for Negative numbers - Evaluate all characters of supplied string
$locallen = Len($expc)
$islower = 1
FOR $localstart = 1 TO $locallen
$localstring = Substr($expc, $localstart, 1)
IF Asc($localstring) < 65 AND Asc($localstring) > 90
$isupper = 0
ENDIF
NEXT
ENDIF
ENDIF
ELSE
; Just evaluate first character of supplied string
$localstring = Left($expc, 1)
IF Asc($localstring) >= 65 AND Asc($localstring) <= 90
$isupper = 1
ENDIF
ENDIF
ENDIF
ENDFUNCTION ; - IsUpper -
|
|
|
|