powered by simpleCommunicator - 2.0.48     © 2025 Programmizd 02
Форумы / Программирование [игнор отключен] [закрыт для гостей] / Pascal
2 сообщений из 2, страница 1 из 1
Pascal
    #32062167
kätzchen
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Privet wsem!
Moget kto znaet,
kak perevesti string v integer w Pascale ili xotja bi kak rabotaet funktija Val?
...
Рейтинг: 0 / 0
Pascal
    #32062235
pima
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Код: plaintext
1.
2.
3.
var v, Code: integer;
begin
    val('12345', v, Code);
    //dalshe eto v mozno ispolzovat kak hochesh


Code - simvol, na kotorom voznikla oshibka (esli stroka sogerzit nechislovie simvoli)

Esli ti v Dephi, to tam est takaya functia StrToInt(s: string): integer
preobrazuet stroky v celoe chislo, esli ne ono ne preobrazuetsa - generit Exception

Help po val is Dephi:
Converts a string to a numeric representation.

Unit

System

Category

string handling routines

procedure Val(S; var V; var Code: Integer);

Description

Val converts the string value S to its numeric representation, as if it were read from a text file with Read.

S is a string-type expression; it must be a sequence of characters that form a signed real number.

V is an integer-type or real-type variable. If V is an integer-type variable, S must form a whole number.

Code is a variable of type Integer.

If the string is invalid, the index of the offending character is stored in Code; otherwise, Code is set to zero. For a null-terminated string, the error position returned in Code is one larger than the actual zero-based index of the character in error.

Val performs range checking differently depending upon the setting of the $R compiler directive and the type of the parameter V.
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Программирование [игнор отключен] [закрыт для гостей] / Pascal
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]