25.06.2013 Views

Il Linguaggio Fortran 90/95

Il Linguaggio Fortran 90/95

Il Linguaggio Fortran 90/95

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1.9 Procedure Intrinseche 83<br />

Naturalmente su calcolatori che non supportano tutti i parametri di kind elencati alcuni valori<br />

potranno essere non rappresentativi. Ad esempio su un PC con processore Intel molti<br />

compilatori attribuiscono alla costante qp, rappresentativa della quadrupla precisione, il valore<br />

-1.<br />

1.9.5 Funzioni per il trattamento dei caratteri<br />

ACHAR(I)<br />

Restituisce il carattere corrispondente alla posizione I nella tabella ASCII. Se I è compreso<br />

tra 0 e 127, il risultato fornito è effettivamente l’I_mo carattere della tabella; se, invece, I è<br />

maggiore di 127, il risultato sarà dipendente dal processore.<br />

Ad esempio, se a è una variabile di tipo CHARACTER, l’istruzione:<br />

a = ACHAR(87)<br />

restituisce il valore ’W’.<br />

ADJUSTL(STRING)<br />

Restituisce la stringa STRING giustificata a sinistra. In altre parole rimuove i bianchi di testa e<br />

li sposta in coda.<br />

Esempio:<br />

CHARACTER(LEN=16) :: str<br />

str = ADJUSTL(’ <strong>Fortran</strong> <strong>90</strong> ’) ! restituisce: ’<strong>Fortran</strong> <strong>90</strong> ’<br />

ADJUSTR(STRING)<br />

Restituisce la stringa STRING giustificata a destra. In altre parole rimuove i bianchi di coda e li<br />

sposta in testa.<br />

Esempio:<br />

CHARACTER(LEN=16) :: str<br />

str = ADJUSTR(’ <strong>Fortran</strong> <strong>90</strong> ’) ! restituisce: ’ <strong>Fortran</strong> <strong>90</strong>’<br />

CHAR(I[,KIND])<br />

Restituisce il carattere che occupa la posizione I nella sequenza di collating del processore,<br />

associato al parametro di kind KIND opzionalmente specificato. Gli argomenti I e KIND devono<br />

entrambi di tipo intero. In particolare il valore di I deve essere compreso tra 0 ed n-1, essendo<br />

n il numero di caratteri del sistema di codifica adottato dal processore. La funzione CHAR è<br />

l’inversa di ICHAR.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!