1С 8.3 Строка нужной длины из указанного символа
Данные > Примеры кода 1С > 1С 8.3 Строка, текст, буквы
Перейти в раздел примеры кода 1С 8.3:
Строка нужной длины из указанного символа в 1С 8.3:
// Возвращает строку нужной длины из указанного символа
// Источник: https://github.com/SeiOkami/CollectionMethodsOneS/issues/120
//
// Параметры:
// Длина - Число
// Символ - Строка
//
// Возвращаемое значение:
// Строка
Функция СтрокаСимволов(Знач Длина, Знач Символ = " ") Экспорт
Квалификатор = Новый КвалификаторыСтроки(Длина, ДопустимаяДлина.Фиксированная);
ОписаниеТипов = Новый ОписаниеТипов("Строка", Квалификатор);
Результат = ОписаниеТипов.ПривестиЗначение(""); // Строка
Если Символ <> " " Тогда
Результат = СтрЗаменить(Результат, " ", Символ);
КонецЕсли;
Возврат Результат;
КонецФункции
// MIT License
//
// Copyright (c) 2024 SeiOkami
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// Источник: https://github.com/SeiOkami/CollectionMethodsOneS/issues/120
//
// Параметры:
// Длина - Число
// Символ - Строка
//
// Возвращаемое значение:
// Строка
Функция СтрокаСимволов(Знач Длина, Знач Символ = " ") Экспорт
Квалификатор = Новый КвалификаторыСтроки(Длина, ДопустимаяДлина.Фиксированная);
ОписаниеТипов = Новый ОписаниеТипов("Строка", Квалификатор);
Результат = ОписаниеТипов.ПривестиЗначение(""); // Строка
Если Символ <> " " Тогда
Результат = СтрЗаменить(Результат, " ", Символ);
КонецЕсли;
Возврат Результат;
КонецФункции
// MIT License
//
// Copyright (c) 2024 SeiOkami
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
0
комментарии
____________________
Перепечатка текста и фотографий разрешена при наличии прямой ссылки на источник