AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 01.05.2014, 20:16   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
Clean off the illegal characters from file name
Источник: http://alexvoy.blogspot.com/2014/05/...from-file.html
==============

When it comes to use file names, say, in saving reports on the disk or sending them as an attachment, they must conform OS restrictions.

Although we cannot rely on GetInvalidFileNameChars function due to its limitation, it is easy to create your own procedure that clean off the illegal characters from the given file name.

In my example I use a regular expression and a set of characters that should be replaced with the underscore by default.


///
/// Checks for invalid characters in the filename and changes them with underscore.
///
///
/// The file name value.
///
///
/// The character to use instead of illegal characters. Underscore by default.
///
///
/// valid file name
///

static client str makeFileNameValid(str _fileName, str 1 _char2use = "_")
{
str pattern = "[/:*?'|]";
str fileName;

fileName = System.Text.RegularExpressions.Regex::Replace(_fileName, pattern, _char2use);
fileName = strReplace(fileName , '\\', _char2use);
return fileName;
}

I used this article.


Источник: http://alexvoy.blogspot.com/2014/05/...from-file.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
За это сообщение автора поблагодарили: Ace of Database (2).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
crminthefield: Creating SSL Certificates for CRM Test Environment Blog bot Dynamics CRM: Blogs 0 10.12.2013 02:12
DynamicsAxSCM: Import vendor catalogs: from setup to importing a sample catalog – Part 2 (Importing a sample catalog) Blog bot DAX Blogs 0 09.09.2012 20:15
Microsoft Dynamics CRM Team Blog: Importing two or more entities from a Single File Blog bot Dynamics CRM: Blogs 0 09.11.2010 19:05
Jim Wang: Get Entity/Attribute's Display Name from CRM database Blog bot Dynamics CRM: Blogs 0 28.03.2009 01:05
Вопрос про Demand Planner slava09 DAX: Функционал 4 25.09.2006 11:43

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 22:39.