Function ValidAngStr returns TRUE if the specified value can be converted into a numeric angle value. If TRUE, the value (in decimal degrees) of the string is returned.
FUNCTION ValidAngStr(
str : STRING;
VAR value : REAL): BOOLEAN;def vs.ValidAngStr(str):
return (BOOLEAN, value)| Name | Type | Description |
|---|---|---|
| str | STRING | String value to be checked for angle validity. |
| value | REAL | Returns numeric angle value converted from input string. |
PROCEDURE Example;
VAR
str :STRING;
value :REAL;
BEGIN
str := StrDialog('Enter the angle:', 'N10E');
IF ValidAngStr(str, value) THEN Message(value);
END;
RUN(Example); ok := TRUE;
outBearing := Compass2Cad(outBearing);
END;
{Azimuth or Bearing, Decimal or DMS}
IF NOT ok THEN if ValidAngStr(inBearingStr, outBearing) then BEGIN
ok := TRUE;
{Azimuth-DMS}
IF ValidNumStr(Copy(inBearingStr, 1, 1), num) THEN outBearing := Compass2Cad(outBearing);
END;
BEGIN
{** Get all needed dialog data here.}
GetItemText(dlogID, 14, tmpStr);
noError := ValidAngStr(tmpStr, gLatitude);
tmpStr := Num2Str(8, tmpReal);
if Pos('.', tmpStr) > 0 then while Copy(tmpStr, Len(tmpStr), 1) = '0' DO tmpStr := Copy(tmpStr, 1, Len(tmpStr) - 1);
IF Copy(tmpStr, Len(tmpStr), 1) = '.' THEN tmpStr := Copy(tmpStr, 1, Len(tmpStr) - 1);
END else if Pos(fldType, 'r10') > 0 then BEGIN {If it's an angle field, convert it to a real.}
tmpBoo := ValidAngStr(valueVa, tmpReal);
tmpStr := Num2Str(8, tmpReal);
while Copy(tmpStr, Len(tmpStr), 1) = '0' DO tmpStr := Copy(tmpStr, 1, Len(tmpStr) - 1);
END;result = vs.ValidAngStr('Example')Availability: from All Versions