Formattare una stringa di testo

Angelo2449

Utente Junior
professione: Pensionato
software: Autocad
regione: Lombardia
Salve a tutti,
come si può formattare una stringa in modo da avere una lunghezza costante predefinita?
Esempio :
- lunghezza costante = 38
- lunghezza effettiva = 12
- spazi da inserire = 26
Grazie
 

Cristallo

Utente Standard
professione: Leggo e confronto
software: Lettura critica
regione: Fuori dalla cerchia
(setq TESTO (entget (car (entsel))))
(setq STRINGA (cdr (assoc '1 TESTO)))
(setq L_Eff (strlen STRINGA))
(setq L_Cost (getint "lunghezza costante stringa:"))
(setq LOOP (- L_Cost L_eff))
(setq STRINGA_rev STRINGA)
(repeat LOOP
(setq STRINGA_rev (strcat STRINGA_rev " "))
);; chiusura repeat
(setq TESTO2 (subst (cons '1 STRINGA_rev) (assoc '1 TESTO) TESTO))
(entmod TESTO2)
 

Statistiche forum

Discussioni
59,306
Messaggi
505,275
Utenti registrati
110,817
Ultimo utente registrato
ANDREA SEREGNO
Top