in the 1C Database we have a list of counterparties, the counterparty's information is the full name and phone number. The task is to remove hyphens from phone numbers in the unloading into a text file, i.e. + 7-901-222-22-22 convert to +79012222222. I understand that it is necessary to use Str-Replace somehow, but I do not understand how to use it in the current form:

Процедура ВыгрузкаКонтрагентов() ЗаписьЖурналаРегистрации("ВыгрузкаКонтрагентов", УровеньЖурналаРегистрации.Информация, , , "Начало выполнения"); Попытка ТекстДок = Новый ТекстовыйДокумент; Запрос = Новый Запрос; Запрос.Текст = "ВЫБРАТЬ | Контрагенты.Ссылка, | Контрагенты.Наименование |ИЗ | Справочник.Контрагенты КАК Контрагенты |ГДЕ | Не Контрагенты.ПометкаУдаления"; Выборка = Запрос.Выполнить().Выбрать(); Пока Выборка.Следующий() Цикл Телефон = ""; СрокаКИ = Выборка.Ссылка.КонтактнаяИнформация.Найти(Справочники.ВидыКонтактнойИнформации.ТелефонКонтрагента, "Вид"); Если Не СрокаКИ = Неопределено Тогда Телефон = СрокаКИ.Представление; КонецЕсли; ТекстДок.ДобавитьСтроку(Выборка.Наименование + ";"+Телефон+";"); КонецЦикла; ТекстДок.Записать("C:\contacts\contacts.csv"); 

    1 answer 1

    Before line

     ТекстДок.ДобавитьСтроку(Выборка.Наименование + ";"+Телефон+";"); 

    put

     Телефон = СтрЗаменить(Телефон,"-",""); 
    • In the output file, in this case, for some reason, the pluses are also removed, i.e. phone numbers are not in the format + 7xxx ..., but in 7xxx Strange, I read the documentation on String Replace, and it should work exactly as you wrote - Nikos Papadopoulos
    • Add information output from the Phone to the screen to the user before the conversion Телефон = СтрЗаменить(Телефон,"-",""); and see if there are pluses. A function really should not remove the plus. - Visman
    • The problem was solved, it seems, it was a joint of Excel (a bug in the display) - Nikos Papadopoulos